In the Figmaster - Lessons Figma file, open the 2.14 Table page.
Introduction
Data tables are used to organize and display data efficiently. In this chapter, you will learn how to create a simple table component with an auto layout. This lesson will cover creating more advanced components, that is, creating larger components with other smaller components.
Step 1. Table Header
Part 1. Table Header with Checkbox
- Grab the Checkbox component from the Assets panel and drop it on the canvas.
- Group it and add the auto layout.
- Rename it to Table Header / Checkbox.
- In the auto layout panel, set the following properties:
- Padding Top and Bottom: 14 px.
- Padding Right and Left: 16 px.
- Alignment: Center - Center.
- Set the groups Fill to Neutral/20.
Part 2. Table Header with Text
- Create a text layer with Table header text inside.
- Set its style to Text M/Medium.
- Color to Neutral/100.
- Group it and add the auto layout.
- Rename it to Table Header / Text.
- Move it, so it's 196 px on the right of the Table Header / Checkbox group.
- Set the same padding properties as in the previous step: 14 and 16 px.
- Select the text inside and set its Resizing width property to Fill container.
- Resize the group to 200 px in width.
Part 3. Component and variants
- Create the Table Header component with variants.
- Property 1 label should be Type.
Step 2. Table Cell
Part 1. Table Cell Checkbox
- Create a Table Cell group with a Checkbox inside just like we did the Table Header / Checkbox with the same padding.
- Rename it to Table Cell / Checkbox / Default.
- The color Fill should be Neutral/10.
- Duplicate it 196 px to the right.
- Rename the new copy to Table Cell / Checkbox / Selected.
- Select the Checkbox inside and change its Status to Active and State to Default.
- Change the color fill of the group to Primary/Surface.
- Duplicate Table Cell / Checkbox / Selected 196 px to the right.
- Rename the new copy to Table Cell / Checkbox / Disabled.
- Select the Checkbox inside and change its Status to Inactive and State to Disabled.
- Change the color fill of the group to Neutral/30.
Part 2. Table Cell Text
- Create a Table Cell group 48 px below the Table Cell / Checkbox. Place a Text layer "Table cell" inside just like we did the Table Header / Text. Make sure the group is 200 px wide and has the auto layout applied.
- Rename it to Table Cell / Text / Default.
- The color Fill should be Neutral/10.
- The text color should be Neutral/90.
- The text style should be Text M/Regular.
- Duplicate it 48 px to the right.
- Rename the new copy to Table Cell / Text / Selected.
- Change the color fill of the group to Primary/Surface.
- Duplicate it 48 px to the right.
- Rename the new copy to Table Cell / Text / Disabled.
- Set the color Fill to Neutral/30.
- Set the text color to Neutral/60.
Part 3. Table Cell with a Badge
Time for practice! Create a Table Cell / Badge group with all three states. Follow the principles from the previous parts. Place a Badge / Danger component inside the Table Cell and make sure it is aligned to the left inside the group. Disabled Badge should be set to 50% opacity.
Part 4. Table Cell with an Action
Create a Table Cell / Action group with all three states. Follow the principles from Part 2. Place a text layer "Action" inside. The text should have the following properties:
- Style: Text M/Medium.
- Aligned to the right.
- Resizing (width): Fill container.
Part 5. Component and variants
- Create the Table Cell component with variants.
- Property 1 label should be Type.
- Property 2 label should be State.
You're doing great! Let's combine the components we've just created to construct a simple Table.
Step 3. Table
Part 1. Table Header Row
- Grab the Table Header component from the Assets panel and place it on the canvas.
- Duplicate it to the right, so there are six copies in total of 0 px from each other.
- Select all copies and group them.
- Apply the auto layout.
- Rename it to Table Header Row.
- Select five Table Headers, excluding the first one on the left.
- In the Instance panel, change the Type of the selected Table Headers to Text.
- Change their Resizing (width) property to Fill container.
- Select the Checkbox inside the first Table Header and change its Status to Indeterminate.
- In the last Table Header, select the text layer and set its layer opacity to 0%.
Part 2. Table Row
- Grab the Table Cell component from the Assets panel and place it on the canvas.
- Duplicate it to the right, so there are six copies in total of 0 px from each other.
- Select all copies and group them.
- Apply the auto layout.
- Rename it to Table Row.
- In the Instances panel, change the Type of the selected Table Cells accordingly. Starting from the left:
- The second one to Text.
- The third one to Badge.
- Fourth and fifth to Text.
- Last one to Action.
- Select five Table Cells excluding the first one on the left and change their Resizing (width) property to Fill container. Just like we did in Part 1.
- Place the Table Row 24 px below the Table Header Row.
- Select both groups and press ALT + H to align them.
Part 3. Divider
- Press L on your keyboard and draw a horizontal line on the canvas. Remember to hold SHIFT to make it straight.
- Make it ~500 px wide.
- Rename the line to Divider.
- Set its stroke color to Neutral/40.
Part 4. Grouping everything together
- Place the Divider between the Table Header Row and Table Header.
- Select all three items and group them.
- Apply the auto layout.
- Rename it to Table.
- Set its Fill color to Neutral/10.
- Stroke to 1 px Neutral/40 Inside.
- Effect to Shadow 1.
- Corner Radius to 4 px.
- Check the Clip content Checkbox in the top right corner of the Figma UI.
- In the auto layout panel, set the Spacing between items to 0.
- Having the group selected, press Enter to select all items inside.
- Set their Resizing (width) property to Fill Container.
- Select the Table Row inside.
- Press CTRL + D to duplicate it, so there are seven Table Rows inside.
- Select Divider line inside the Table.
- Duplicate it and press Arrow Down to move it between Table Rows below.
- Repeat the action, so each Table Row is divided.
Great job! Congratulations! Now you can play with the Table component and see how it works. Try changing text or selecting the elements in the Table Row and changing their State. When you are ready, proceed to the next chapter.