

Doing so would make it easier to onboard new engineers, tackle unforeseen challenges, and introduce new themes down the road. We wanted to build a solution that wouldn’t just solve the existing need for a new feature, but would be flexible enough to scale with us as the product evolved. But we quickly discovered that the project was much more complex than that. Boolean variablesīoolean variables can be mapped to variant properties with true and false values.On the surface, implementing dark mode seemed like a straightforward front-end change: Simply swap every light color for a dark one. Now, the instance will switch to a different variant whenever the mode switches. Click Assign variable and choose the variable.Grab a component instance of the variant, and hover over the variant property in the right sidebar.Set the variable’s values to match the variant property’s values.Create a string or number variable with multiple values (or modes).To do this, the variable’s value must match the variant property’s values. String and number variables can be mapped to variant instances so it switches to a different variant when its mode changes. If no parent containers have a mode specified, then the objects fallback on the collection’s default mode, shown in parentheses.īoolean, number, and string variables can be assigned to component instances with variant properties.If their parent container is also set to Auto, objects continue up their layer hierarchy until they reach a container with a specified mode.This means they take on the mode of their parent container. Objects with variables have their modes set to Auto by default.

This means they take on the collection’s default mode, shown in parentheses. Pages with variables are set to this mode by Default. Default modeĪ variable collection's default mode is the first mode column of that collection. This can happen when the disabled mode lives in a different file and contains published updates, but the current file hasn’t accepted updates yet. Modes get disabled when a variable in a selection or page (when nothing is selected) maps to a disabled mode, but contains conflicts. Note: You can’t switch to modes that are greyed out in the change variables menu. From the Page section of the right sidebar, click Change variable mode.You can switch modes on pages if any local collection of variables contains multiple modes. If there are multiple modes, hover over the tag to see a list of modes. Once you specify a mode on an object, a tag with the mode icon and mode name will appear next to the layer name in the Layers panel of the left sidebar. Hover over a variable collection and choose a mode.From the Layer section of the right sidebar, click Change variable mode.Select the layer, group, or container object.You can switch modes on:įor layers: You can switch their modes if there is at least one variable applied and the variable has multiple modes.įor groups, frames, components, component sets, and sections: You can switch their modes if nested layers have at least one variable applied and the variable has multiple modes. Switch an object or page’s mode to the set of variable values you want designs to show. Layers with variables applied will default to this mode unless you switch their modes ↓. Tip: A collection’s default mode is the first column on the left. You can also duplicate a mode by right-clicking the mode header and selecting Duplicate mode. Figma duplicates values from the first mode column to the new one. Click the New variable mode icon to the right of the column headers.Open the collection you want to create a new mode in.Open the Variables modal by clicking Open variables in the Local variables section of the right sidebar.Devices sizes to see how elements look with different spacing and padding.Different languages to see how copy flows in designs.Different color themes, like light and dark modes.Here are a few ways you can use modes to switch contexts: If a variable collection has multiple modes, then we can switch modes on layers and elements to quickly change designs for different contexts. A mode contains a list of values for a variable within a collection, storing one value per variable. Variable modes represent the different contexts of our designs. New to variables? Check out our guide to variables →
