In the Figmaster - Lessons Figma file, open the 2.3 Button page.
Introduction
Buttons are clickable items used to perform an action. In this chapter, we'll create buttons. Lots of them! I bet you've made buttons in Figma previously, but I want to show you my way of doing this. You'll learn how to create button states and variants quickly.
Level up! In this chapter, I will skip the common keyboard shortcuts we have used in the previous lessons. I bet you remember them now. If not, check the keyboard shortcuts sections at the bottom to recall them.
Plugins in this lesson
Button: Size Normal
Step 1. Base
Standard procedure. First, we will create the base for our button component. Then, we'll duplicate it to create states and different variations. Let's go!
Part 1. Text Only Button
- Create a text layer with a Button text inside.
- Apply the Text M/Medium style.
- Group it and apply the Auto Layout.
- Rename it to Button / Text Only / Normal.
- Change the Auto Layout settings to:
- Padding Right and Left: 16 px.
- Padding Top and Bottom: 6 px.
- Alignment: Center - Center.
- Spacing between items: 4 px.
- Apply the Corner radius of 4 px.
- Apply the colors:
- Primary / Main to Button's background.
- Neutral / 10 to Button's text.
- Apply the Effect: Shadow 1.
Part 2. Icon Text Button
- Duplicate the Button 32 px to the bottom.
- Rename the new copy to Button / Icon Text / Normal.
- In the Assets panel (ALT + 2) search for Icon / BellSimple.
- Drop the Icon inside the Button on the left.
- Resize the Icon to 16x16 px.
- Change the Icon's color to Neutral / 10.
Part 3. Icon Only Button
- Duplicate the Button / Icon Text / Normal 32 px to the bottom.
- Rename the new copy to Button / Icon Only / Normal.
- Remove the text layer from the latest copy.
- Resize the Icon, so it's 20x20 px.
- In the auto layout settings:
- Change the padding to 6 px (all sides).
Step 2. Button States
Great job! We have the base ready. Time to create states for our buttons.
Part 1. Default state
- Select all buttons and align them to the left (ALT + A).
- Having them selected, press CTRL + R to open the Rename modal.
- Click in the Rename to input and press the Current name button.
- Then type in / Primary / Default so you will have $& / Primary / Default in there. Press Enter.
- Select all three buttons and duplicate them 48 px to the right.
Part 2. Hover state
- Select three new buttons on the right.
- In the Selection colors panel, change the Primary / Main color style to Primary / Hover.
- Having all three buttons selected, open the Rename modal.
- In the Match (optional) field, type in Default.
- In the Rename to field, type in Hover and press Enter.
- Duplicate these three buttons 48 px to the right.
Part 3. Focused state
The Button with a focused state needs to be grouped because we need to add an outline stroke. Since the Outlined Button will have a stroke itself, we need an extra group so we can have two strokes.
- Select three new buttons on the right.
- Remove the shadow effect.
- Open the Rename modal.
- In the Rename to field, type in Button and press Enter.
- Select the first Button on the top and group it.
- Apply the auto layout.
- Change its name to Button / Text Only / Normal / Primary / Focused.
- Select the second Button and group it.
- Apply the auto layout.
- Change its name to Button / Icon Text / Normal / Primary / Focused.
- Select the third Button and group it.
- Apply the auto layout.
- Change its name to Button / Icon Only / Normal / Primary / Focused.
- Select all three Focused buttons.
- Set their Corner radius to 5 px.
- Having them three selected, apply 3 px Primary/Focus Outside stroke.
Part 4. Pressed state
- Select three Hover buttons.
- Duplicate them 48 px to the right of the Focused buttons.
- In the Selection colors panel, change the Primary / Hover color style to Primary / Pressed.
- Having all three buttons selected, open the Rename modal.
- In the Match (optional) field, type in Hover.
- In the Rename to field, type in Pressed and press Enter.
- Remove the Shadow 1 effect.
- Duplicate these three buttons 48 px to the right.
Part 5. Disabled state
- Select three new buttons on the right.
- In the Fill panel, change the color style to Neutral/30.
- In the Stroke panel, add a 1 px Neutral/40 Inside stroke.
- In the Selection colors panel, change the Neutral/10 color style to Neutral/60.
- Having all three buttons selected, open the Rename modal.
- In the Match (optional) field, type in Pressed.
- In the Rename to field, type in Disabled and press Enter.
Step 3. Variants
Part 1. Secondary Button
- Select all 15 buttons.
- Duplicate them 64 px to the bottom.
- Open the Rename modal.
- In the Match (optional) field, type in Primary.
- In the Rename to field, type in Secondary and press Enter.
- Select all new buttons.
- In the Selection colors panel, change all Primary colors (excluding Primary/Focus) into Primary / Surface.
- Select all Secondary - Default Buttons.
- In the Selection colors panel, change the Neutral/10 style to Primary/Main.
- Select all Secondary - Hover and Focused Buttons.
- In the Selection colors panel, change the Neutral/10 style to Primary/Hover.
- Select all Secondary - Pressed Buttons.
- In the Selection colors panel, change the Neutral/10 style to Primary/Pressed.
Part 2. Outlined Button
- Select all Primary (the first 15 we created) buttons.
- Duplicate them 64 px to the bottom below the Secondary buttons.
- Open the Rename modal.
- In the Match (optional) field, type in Primary.
- In the Rename to field, type in Outlined and press Enter.
- Select all Outlined - Default Buttons.
- In the Selection colors panel, change the Neutral/10 style to Neutral/100.
- In the same panel, change the Primary/Main to Neutral/10.
- In the Stroke panel, add a 1 px Neutral/40 Inside stroke.
- Select all Outlined - Hover Buttons.
- In the Selection colors panel, change the Neutral/10 style to Neutral/100.
- In the same panel, change the Primary/Hover to Neutral/20.
- In the Stroke panel, add a 1 px Neutral/40 Inside stroke.
- Select all Outlined - Focused Buttons and press Enter to select groups inside.
- In the Selection colors panel, change the Neutral/10 style to Neutral/100.
- In the same panel, change the Primary/Hover to Neutral/20.
- In the Stroke panel, add a 1 px Primary/Main Inside stroke.
- Select all Outlined - Pressed Buttons.
- In the Selection colors panel, change the Neutral/10 style to Neutral/100.
- In the same panel, change the Primary/Pressed color to Neutral/30.
- Add an Inside stroke of 1 px with a Neutral/50 color style.
Part 3. Danger button
- Select all Primary (the first 15 we created) buttons.
- Duplicate them 64 px to the bottom below the Outlined buttons.
- Open the Rename modal.
- In the Match (optional) field, type in Primary.
- In the Rename to field, type in Danger and press Enter.
- In the Selection colors panel, change the color styles accordingly:
- Primary/Main to Danger/Main.
- Primary/Hover to Danger/Hover.
- Primary/Pressed to Danger/Pressed.
Part 4. Text Button
- Select all Secondary buttons.
- Duplicate them 64 px to the bottom below the Danger buttons.
- Open the Rename modal.
- In the Match (optional) field, type in Secondary.
- In the Rename to field, type in Text and press Enter.
- Select all Text / Focused buttons and press Enter to select the groups inside.
- In the Fill panel, click on the minus icon to remove the Fill style.
- Select all Text buttons, EXCLUDING the Focused state.
- In the Fill panel, click on plus Icon and remove the style that appeared with a minus icon.
- Remove the stroke with a minus icon.
- Remove the Shadow 1 effect.
Button: Size Big
You are doing great! It's time to create Big button variants. I will show you a quick way, so we don't have to repeat ourselves!
Step 4. Big buttons
Part 1. Base
- Select all buttons we've just created.
- Duplicate them, so all new copies are 96 px below the Normal buttons.
- Having them all selected, open the rename modal.
- In the Match (optional) field, type in Normal.
- In the Rename to field, type in Big and press Enter.
- Having them all selected, press Enter three times.
- Change their Text style to Text L/Medium.
- Having all Big Buttons selected, press CTRL + X to cut them.
- In the Pages panel on the left, create a Big Buttons page.
- **Open **the page and Paste Big buttons on the canvas.
We had to move our Big Buttons to a different page because the plugin would also select Normal Buttons and we don't want that.
Part 2. Plugin
Remember that the Figmaster will close after you open the Similayer plugin. You will find the instructions in Figma too.
- Open the Similayer plugin.
- Select the Button / Text Only / Normal / Primary / Default (the first one on the top left).
- In the Similayer plugin UI, in the left sidebar, and find the Padding property and click on it.
- The press Select layers button.
- The plugin will close, and all buttons (excluding Icon Only) will be selected.
- In the Auto layout panel, change their Top and Bottom Padding to 8 px.
- Repeat the action for Icon Only buttons where their padding (all sides) is set to 10 px.
- Select all Big buttons and cut them CTRL + X.
- Paste them and move 96 px below the Normal buttons on the 2.3 Button page.
Step 5. Components and variants
- Select all buttons.
- Click on Create multiple components in the Component dropdown menu at the top center of Figma UI.
- Click on Combine as variants in the Variants panel.
- Rename the Property 1 label to Content.
- Rename the Property 2 label to Size.
- Rename the Property 3 label to Type.
- Rearrange the Types with your mouse in the following order: Primary, Secondary, Outlined, Danger, Text.
- Rename the Property 4 label to State.
- Rearrange the Types with your mouse in the following order: Default, Hover, Focused, Pressed, Disabled.
Fantastic job! You've just created a button component with a lot of variants! As you can see, we've used some tricks to save our time on repetitive tasks. Using the Selection colors panel, Rename modal, and plugins make our job easier. Keep that in mind! Let's proceed to the next chapter.