Figma: Components
Tags: figma, prototyping
Published: 2022-04-14 10:07:59

## Table of Contents
1. [Why use components?](#why-use-components)
2. [Creating Components in Figma](#creating-components)
3. [Nested Components](#nested-components)
4. [Tips on Using Components](#tips-on-using-components)
5. [Helpful Links](#helpful-links)

### Why Use Components?
#### First, what are [components](https://www.figma.com/blog/components-in-figma/)?
Components are UI elements that can be reused. Think of them like templates. A component can be a button, an icon, a data table, etc. Whenever you change the main component, all the other components created from it will automatically update. This will speed up all your design work, make your design system more consistent, and make it much easier to maintain.

#### Why use components?
1. Using components will save a lot of time during your design process
2. Components will keep your design consistent and clean

> When designing Components, our goal was to make them:
> 
> - easy to learn for anyone to get started
> - powerful enough for advanced users
> - flexible enough to work throughout the design process
>
> [Figma](https://www.figma.com/blog/components-in-figma/)

You're also able to import components into Figma. You'd do this by opening the page, selecting the specific files, and simply drag and drop into your Figma page. Super easy!

### [Creating Components](https://www.figma.com/blog/components-in-figma/)

![components](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8gbg40q87bunfa5t34to.png)

To create a component, you can `right-click` on the element and click on `Create component` to create the master component. Alternatively, you can hit `Ctrl+Alt+K` (for Linux). At this point you will see the master component symbol (shown in the image below) on the respective element.

![master component](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f20ejb5wcjbsfivoz9xd.png)

From here, when you create a copy of the master component, you will be creating what are called instances of the master component. When you do this you will see an instance symbol (shown in the image below) on those elements. 

![components symbols](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r1ovurq69nm5gi7c12t6.png)

There will come to a point when you've created multiple instances and need to find your master component again. You can quickly do this by `right-click`ing any of your instance components, and click on `Go to main component`. The master component will appear in the sidebar on the left-hand side.

If you accidentally delete your master component, don't worry! You can restore it from any of your instances from the right-hand panel. There is a `Restore Master Component` option that will make your master component appear immediately.

### [Nested Components](https://designcode.io/figma-components-and-nesting)
A component can exist inside another component, or [nested inside another component](https://www.pluralsight.com/guides/understanding-the-purpose-nested-components). In order to do that, you are able to put an instance of a component into another master component. See the below image for reference.

![nested components](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gk3rduygh14fvbvsen90.png)

### [Tips on Using Components](https://medium.com/design-with-figma/10-tips-on-using-components-in-figma-c7db9c5e7fe1)

- Use clear naming conventions
	+ Forward slash naming
- Use frame containers
- Use multiple libraries
- Use component shortcuts and swap components
- Set up constraints and layout grids for predictable behaviors
- Use clip content to reduce repetitive instances
- Use the quick insert menu
- Add component documentation
- Use slot components
- Detach an instance to remove relationship from master components


### Helpful Links
- [How to create an Auto-Layout powered Component in Figma](https://www.marcandrew.me/how-to-create-an-auto-layout-powered-component-in-figma/)
- [An Introduction to Figma Interactive Components](https://www.smashingmagazine.com/2021/07/introduction-figma-interactive-components/)
- [Guide to Figma Components](https://help.figma.com/hc/en-us/articles/360038662654-Guide-to-Components-in-Figma#:~:text=Click%20on%20a%20component%20set,your%20preferred%20combination%20of%20values.)

Happy coding!