Skip to main content
Question

Memory usage of variants vs. booleans, any news?

  • February 6, 2025
  • 3 replies
  • 61 views

Leter

I’m struggling with the topic of variants vs. booleans in relation to memory usage of hidden layers with the latter solution. The best answer on the most detailed thread I found about this being almost 3 years old, I wonder if there have been any news about this.

 

I’m currently designing several products that heavily rely on tables. These tables are built using different sizes (sm, md, lg) of table cells. Each cell contains a “Content” nested component, with variants for a dozen content types (text, icon, button, ranking stars, etc.). 

Some of these content types rely on base components with dozens of variants (e.g., a Text element with configurations such as Title, Title + Subtitle, Title + Subtitle + Icon, Body, Body + Subtitle, etc.).

 

The reason I’m using such a deep nesting of components is to allow for easier updates across all tables in the future. However, I’m concerned about performance, as changing some subcomponents already takes a while due to the number of instances being updated at once.

 

This brings me back to the Boolean dilemma. Suppose I need six text configurations for text-based table cells:

Title

• Title + Subtitle

• Title + Subtitle + Icon

• Body

• Body + Subtitle

• Body + Subtitle + Icon

 

Should I keep six separate variants, or reduce them to just two variants with two Boolean properties (Show/Hide Subtitle and Show/Hide Icon)?

 

Considering that I actually have many more text configurations (since I use this base text component not only in tables but also in cards and other elements), and that I’m applying it to several tables containing 100–200 cells each, I’m concerned about memory usage. If I use Booleans, I might end up with hundreds of hidden layers in each table.

 

Have there been any recent updates or official recommendations from Figma on this matter?

I have purchased recent high-quality UI kits and seen both solutions used. There doesn’t seem to be a consensus.

3 replies

Joshua_Harwood

+1 to this question. 

Would be great to understand the performance considerations more clearly. 
1. Large variant sets VS component properties.
2. Nested instances VS embedded (and more variants)


Wirkkarl
  • New Participant
  • 15 replies
  • May 5, 2025
Leter wrote:

I’m struggling with the topic of variants vs. booleans in relation to memory usage of hidden layers with the latter solution. The best answer on the most detailed thread I found about this being almost 3 years old, I wonder if there have been any news about this.

 

I’m currently designing several products that heavily rely on tables. These tables are built using different sizes (sm, md, lg) of table cells. Each cell contains a “Content” nested component, with variants for a dozen content types (text, icon, button, ranking stars, etc.). 

Some of these content types rely on base components with dozens of variants (e.g., a Text element with configurations such as Title, Title + Subtitle, Title + Subtitle + Icon, Body, Body + Subtitle, etc.).

 

The reason I’m using such a deep nesting of components is to allow for easier updates across all tables in the future. However, I’m concerned about performance, as changing some subcomponents already takes a while due to the number of instances being updated at once.

 

This brings me back to the Boolean dilemma. Suppose I need six text configurations for text-based table cells:

Title

• Title + Subtitle

• Title + Subtitle + Icon

• Body

• Body + Subtitle

• Body + Subtitle + Icon

 

Should I keep six separate variants, or reduce them to just two variants with two Boolean properties (Show/Hide Subtitle and Show/Hide Icon)?

 

Considering that I actually have many more text configurations (since I use this base text component not only in tables but also in cards and other elements), and that I’m applying it to several tables containing 100–200 cells each, I’m concerned about memory usage. If I use Booleans, I might end up with hundreds of hidden layers in each table.

 

Have there been any recent updates or official recommendations from Figma on this matter?

I have purchased recent high-quality UI kits and seen both solutions used. There doesn’t seem to be a consensus.

It sounds like you're dealing with a complex setup, and I can understand your concerns about performance. When using deep nesting of variants, the memory load can indeed become significant. A possible solution to mitigate performance issues could be to use boolean values to toggle certain elements instead of nesting deep variants, as they can be more lightweight.

For more insights on this, you might find some relevant advice in this Figma community thread.

Also, check out Phonexa for innovative solutions if you're looking for tools to help manage such projects more efficiently!


Brett_Taylor1

I use boolean, easier to just turn things on and off as you need them.  I have one component called table-row-cell. in it I have objects in this order: checkbox icon text icon. each is setup up for show/hide. This covers a majority of my needs and if something more specific is needed i just detach the component and make it more customized for that instance. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings