Components and variants
Make a layer reusable, keep its copies in step, and draw its states as variants.
Early access
A component is a layer you design once and use many times. Every copy, called an instance, follows the main component: change the main one and they all change, while each copy keeps its own text and the things you changed on it.
Make a component
Select the frame you want to reuse, such as a button or a task row.
Press ⌘ ⌥ K (Create component). Its icon in Layers changes to show it's a main component.
To place a copy, open Assets in the left rail, find the component with Search local components, and drag it onto the canvas, or choose Insert instance. You can also copy and paste the main component.
Add variants
Variants are the states of one component, kept together in a component set: a task row that's done and not done, a button that's primary and secondary.
Make the set. From one component, choose a control in its Behaviour section, such as Checkbox, then Add Off and On variants (or Add state variants for a button). From several components, select them all and press ⌘ Shift K (Create component set).
Select the set. Its Variants section is in the Design panel. Add variant adds another one.
Rename the property and its values (for example State: Default and Done) under Property name, and draw each variant the way it should look.
With one variant selected, + is Duplicate variant, for another state. With the set selected, it's Add variant property, for a second axis such as Size.
On an instance, pick its variant from the menus in Component properties.
Behaviour
A component can work like a real control in prototypes and in the code you get from it: a Switch, Checkbox, Slider, Tabs, a Button with hover and pressed looks, and more. Choose one in the Behaviour section; Add Off and On variants or Add state variants draws the states you need to start from.
Work with instances
| To | Do this |
|---|---|
| Change a copy's text or hide a part | Edit it on the instance; the change sticks when the main component changes |
| Open the main component | Right-click the instance › Go to main component |
| Make a copy an ordinary frame | Detach instance (⌘ ⌥ B) |
| Share components with other files | Publish the file as a library |
Next: Start from a prompt.
Was this page helpful?