Building flexible components in Figma
I have published a newer version of this article, with updated techniques, based on newer features available in Figma. The techniques outlined below work well, but can get be harder to maintain and also impact the performance of your document if it gets too big. Head over to “Component architecture in Figma” for an updated look on components.
When I first started using Figma, how to handle components, instances of components, and nested components wasn’t immediately obvious. After reading a number of articles (hoping for some more insights into how they planned to handle nested components), Tom Johnson tipped me off in a response to a Medium reply with his method of structuring components. This helped me tremendously and thought it would be helpful to share Tom’s tip with others now that I have had a chance to use it. Perhaps this may change in the future, but it is a good solution in the current iteration of Figma (2.0).
The first thing to remember: Figma handles anything pertaining to overrides at the component level on your artboard (frame). Where Sketch gives you more control over instances, Figma gives you more control of the overrides. There is no editing input fields in the inspector pane like in Sketch, overrides are taken care of right on the artboard. You can manipulate the text directly within an instance of your component, show/hide layers within any nested component, adjust opacity/effects, or change colours. At any point you can reset an instance of your component back to its default state.
One solution is to design your visuals and turn them into individual components. Following that, take the instances of those components and assemble them into one master component. This master component will house each of the components instances which are alike and will maintain a link back to the originals (in case you need to make edits). From there you can nest those master components into other components. In the example below I’ve used a button with an icon and text label as an example.
Each icon is designed on a consistent 30 × 30 grid, and then assembled into a master icon component. The master button is built similarly; normal button state paired with hover, active, and disabled states (which I will handle as transparent overlays). The text has also been converted into a component so that the text style can be centrally managed. From there, instances all of these elements can be assembled into a single master button component. From that component you can control many states and instances of the same button:
Controlling the look is as simple as showing hiding components within the nested components. It requires a bit more setup and forethought than than Sketch, but the end result works really well.
Within each nested component Figma also has an option under the Object menu to “Hide Other Layers” which will turn off all other layers other than the one you have selected (within the parent component). This is a great feature for isolating the component you want to make visible.
Access the Figma file
For those interested in taking a closer look, you can duplicate the artwork into your Figma account by clicking here.