Advanced Figma Workflows and Techniques
Component Variants
Variants: Taming Component Chaos
You've mastered components, but now your assets panel is overflowing. You have a button for the default state, one for hover, another for disabled, and maybe a few more for different colors. It's a lot to manage. If you need to change the corner radius, you have to edit each one individually.
This is where variants come in. Variants let you group and organize similar components into a single, neat container. Instead of having a dozen separate button components, you have one 'Button' component. From there, you can use properties to switch between its different states, styles, or sizes right from the design panel.
Variants bring a range of new possibilities to components and scalable design systems.
Combining Components into Variants
Let's start with a practical example. Imagine you have three separate components for a button: a default state, a hover state, and a disabled state.
To combine them, select all three components on your canvas. In the right-hand sidebar, you'll see a section called 'Variants'. Click the 'Combine as Variants' button.
Figma will wrap your components in a new purple, dashed-line frame. This frame is now a single component set. You've successfully created your first variant!
Setting Up Smart Properties
When you combine variants, Figma automatically adds properties and values based on the names of your original components. It's good, but we can make it better. For our button example, it might create a property called 'Property 1' with values like 'Default', 'Hover', and 'Disabled'.
Let's rename 'Property 1' to something more descriptive, like 'State'. This makes it clear what the property controls. You can do this by selecting the component set and editing the property name in the sidebar.
You aren't limited to just one property. You can add more to handle other variations. For a button, you might add properties for its style or whether it includes an icon.
| Property | Values |
|---|---|
| State | Default, Hover, Active, Disabled |
| Style | Primary, Secondary, Destructive |
| Icon | True, False |
Each combination of these properties defines a specific variant within the component set. For example, you can now have a button with State: Hover, Style: Primary, and Icon: True.
To configure this, you select each individual component within the purple frame and assign the correct property values in the sidebar. The component representing the hovered primary button with an icon would get those exact values. Now, when you use an instance of this button component, you can toggle these properties easily.
Clear naming is crucial. Use logical names for properties (like 'State', 'Size', 'Color') and values (like 'Default', 'Small', 'Primary'). This makes the component intuitive for anyone on your team to use.
Best Practices for Scalable Systems
Variants are foundational to building a design system that can grow without becoming a mess. Here are a few things to keep in mind.
Structure with Base Components. If your variants start becoming overly complex with too many properties, it can be a sign that you should use a base component. For example, create a base component for the button's core structure (padding, text style). Then, create your variants using instances of that base component. This way, a single change to the base component will update all its variants at once.
One Component, Many States. The goal is to have one component that can adapt to any context it's placed in. Instead of having separate 'Login Button' and 'Sign Up Button' components, you have a single 'Button' component. You can then change its text and style properties as needed. This reduces clutter and makes your system the single source of truth.
By creating templates and components in Figma, you ensure consistency across projects, making it easier for team members to follow a unified path.
This structured approach not only makes your designs more consistent but also streamlines the handoff process to developers. When your variants map directly to the states and properties in their code, everyone is speaking the same language.
What is the primary benefit of using variants in Figma?
You have created a variant set for a button. If you need to change the corner radius for all button variants at once, what is the most efficient method?
By organizing components into variants, you create a more powerful, flexible, and maintainable design system.