Creating Resizable Data Tables in Figma

Michael Haase
Enterprise Design Talks
10 min readAug 5, 2020

In this article I’ll show you how to increase your productivity when working with data tables in Figma. Using a combination of auto-layout frames and regular constraints we will create a responsive data table that can be reused across projects. This will help you save time the next time in your next project.

Resizing behaviour of the table we will create.

The Task

In enterprise applications I work on, almost everything is a table, except for the logout button. All joking aside, tables are ubiquitous in the product I am working on and I need to update it using a new design system. That’s why I need a setup in Figma that allows me to:

  • Quickly create tables from scratch from reusable components.
  • Resize the entire table or individual columns with as little manual work as possible.
  • Quickly switch between cell formats and states.
  • Design for the current styles AND make it easy to migrate to the new system.
  • Easily maintain and update the components. This may seem obvious, but if you have too many layers of hierarchy in your components they can become very cumbersome to maintain and use in your design.

Before We Start

I will assume that you already have some basic familiarity with Figma and know how to work with components and styles. Data tables are an advanced topic, so I will go over some initial considerations rather quickly.

Use Overrides as Little as Possible

From my experience in working in Figma it’s always preferable to swap components and styles, rather than overriding things across instances throughout your file. The more overrides you use, the more time you will need to update them individually if the design changes. Sooner or later, you will lose track of the overrides and inconsistencies in the design will inadvertently sneak in.

Use Styles to Reduce the Number of Components

There are many different approaches to work with and structure components in Figma. The important part for me is to find the sweet spot where my components are robust enough so that I can focus on the content, while at the same time not being overly complex up to a point where they become practically unusable for daily use (because of too many layers of hierarchy and nesting).

That’s why I like to use styles to reduce the amount of components in my design system. You’ll see in a minute, how this approach comes in handy when working with tables.

Creating the Cell Components

As much as I like auto layout, we are not going to use it to create the cell components. The reason is that, at the time of writing this article, I am not aware of a technique in Figma which would allow me to use auto layout to create fully “content responsive” tables. By that I mean that when I edit the text of one cell, the other cells in the same column should automatically resize as well. I came pretty close, but it’s not quite there yet.

For now, I find it easier and more flexible to use regular on the cell level and use auto layout to assemble the table. But first things first. Let’s build out the cells for now.

Step 1: Create the Border Component

First, we are going to create a component for the cell borders. This makes sense even if you don’t need borders at the moment, but you might in the future. In my case, it’s the other way around. Data tables in my product currently have borders, but I will have to remove them when we migrate to the new design.

  1. For the top and bottom borders, create two rectangles, each 192px wide and 1px high. Name them “Border Top” and “Border Bottom”.
  2. For the left and right border create two rectangles with a width of 1px and a height of 40px. Name them “Border Left” and “Border Right”.
  3. Align the borders so that they form a rectangle, select all of them and create a frame from the selection. Rename the resulting frame to “Borders”
  4. Within the new frame, select each border and set the constraints as shown in the picture below. Now you can resize the “Borders” frame in any way you like and the length of each border will resize correctly.
  5. Finally, turn the “Borders” frame into a master component, so that we can reuse it in the table cells, which we are going to create in the step 2.
The final border component with constraints for each border.

Creating a component just for borders may seem complicated at first, but it gives you the flexibility to change properties like visibility, width, color or style for each border individually.

You might also wonder why I use rectangles instead of lines to create the borders. In my opinion, rectangles are easier to use and more flexible than lines. They are easier to select and manipulate. However, if you are more comfortable with using lines, feel free to do so.

Step 2: Create the Table Cells

We are going to need two distinct types of cells: data cells that hold the actual data and header cells, which contain the name of the column and an icon that lets the user sort the column.

The Data Cells

  1. Insert an instance of the border component on the canvas.
  2. Select the border component and create another frame around it by clicking “Option+Command+G”. Now you have a frame that includes the border component inside it. Rename the new frame to “Cell”.
  3. Add a text layer inside the frame and add some placeholder text. I used “Text” but you can use whatever suits you.
  4. Resize the text layer so that the margins for top/right/bottom/left fit your needs. I am setting mine to be 16px for right/left and 12px for top/bottom.
  5. While you have the text layer still selected, set its horizontal constraints to “Left & Right” and the vertical constraints to “Center”.
  6. Now select the border component and set its constraints to “Left & Right” and “Top & Bottom”.
  7. Finally, select the entire cell frame and create a master component of it. I also gave it a white fill.
Anatomy and constraints for the data cell you just created.

In the same way, create additional components for the other cell types that you need. I won’t go through each of them here, as the process is the same.

The Header Cell

Now we need to create the header cell. I created separate master components for header cells, because they are are different from data cells in terms of border styles, margins or text styles.

I won’t go over the entire process for creating the component again, as it is the same as for the data cells. The only additional thing is that I added a 16x16px icon within the header cell. It is 16x16 pixels in size with 8px margins to the text layer and the borders. As you can see in the image below, the horizontal constraints are set to “Right” and the vertical constraints to “Center”.

Anatomy and constraints for the header cell component.

A Side Note about Cell Types and States

There are a few different approaches on how to deal with states.

The first approach is to manage states using colour and text styles, which minimizes creating multiple components for each state. The advantage of this approach is that you can quickly select all cells that you want to change (using Shift+Cmd+Click) and just change the style for all elements at once.

This way you have less components to worry about and it is more efficient to make changes in the table. The downside is that you use overrides a lot. This is not really a problem, though, as long as you use text and colour styles.

The second approach is to create a component for each state and possibly even for each cell type, even if they are similar (e.g. currency and numbers or text and links). The pro is that you don’t use overrides and once you update the library file all instances get updated. The downside is that you end up with more components. More importantly, it becomes cumbersome to switch the states across different columns.

This approach might be appropriate if you expect that the states in your design have multiple differences beyond just the background colour or you want to be quite restrictive in your design system.

Using styles can reduce the number of components and save time when editing the table.

I use a hybrid approach to create one component for each cell type but manage cell states via styles. This makes the components more transparent to use across projects and easier to maintain in the design library. With this approach, I feel that I have better control over the system at scale.

I create components for each cell type, but not for each state.

Step 3: Create the Table Columns

Wait. Why do I work with columns instead of creating rows? The answer is: it depends. I like to organise data tables into columns, because I need to change the column width (or the table width) way more often than the row height.

Finally, here is where the fun with auto layout actually starts:

  1. Insert an instance of the header cell component onto the canvas.
  2. Insert two instances of the body cell and change the background colour of the second to the alternate style. If you do not have alternating backgrounds, you just need one cell.
  3. Rename the body cells to “Row 1” and “Row 2” and duplicate them five times to get ten rows. Notice that Figma automatically renamed the instances to “Row 3” through “Row 10”.
  4. Select everything and add auto layout.
  5. Rename the newly created frame to “Column 1”.
  6. Inside “Column 1” select all 11 cells and set them to “stretch horizontal”. This last step is important, because it makes the cells stretch when you change the column width.
Create the first column with auto layout.

Step 4: Assemble the Data Table

So we have just created our first column. Great. Let’s make a few more:

  1. Duplicate column 1 a couple of times.
  2. Select all columns and add auto layout. Then rename the resulting frame to “Data Table”.
  3. Now you can resize any column and the other ones will move with it.
Use auto layout to create your base table.

Consider Creating Master Components for Columns (optional)

For each data type I create a component of entire columns that hold sample content and a reasonable amount of cells. This helps me save time when I need to create tables in new projects.

Sometimes I even make a component out of the entire table, if the exact same table, including its content, is used on many screens or across different projects. If you are working on a product for a longer period of time, this approach might make sense for you as well.

Create a new table in less than a minute using column components.

Step 5: Create the Title and Pagination Tool Bars

That was fun! Now we only need two more elements: A title bar that holds the title of the table and offers table actions, like download, export and printing, as well as the pagination controls at the bottom of the table. After all we have been through so far, this will be easy.

The Title Bar

  1. Insert three icon components from your library onto the canvas. They need to be components, so that you can easily swap them out in your projects. So if you don’t have included the icons you use in your design library file, now would be a good time to start.
  2. Select all three icons and create an auto layout frame from them. Set the distance between the icons to 8px.
  3. Create a text layer for the table title.
  4. Select the name and the icon group and create a regular frame.
  5. Set the constraints of the icon group to “Right” and “Center”.
  6. Set the constraints of the table name to “Left” and “Center”.
  7. Give the Frame a white background fill.
  8. Rename the frame to “Table Title” and create a component. Done.
Creating the title bar is easy.

The Pagination Tool Bar

The pagination tool bar consists of three components: the row count dropdown, the pagination controls and the “jump to page” input field.

I have created separate components for each of them. I’m not going into details on how to create these three components. The process is the same as for the header:

  1. Group the three components into a new frame.
  2. Group the pagination and the “jump to” controls into an auto layout frame and rename that frame to “Pagination” (or something that makes sense to you.
  3. Set the constraints of the pagination group to “Right” and “Center”
  4. Set the constraints of the row count dropdown to “Left” and “Center”.
  5. Give the frame a white background, rename it to “Footer” and create a component.

Step 6: Put it all together

Ok, we’re almost done. We only need to add the title bar and the pagination tool bar.

  1. Insert the title bar and pagination tool bar from the assets menu.
  2. Select the title bar, the data table and the pagination tool bar and add auto layout.
  3. Set the title bar and the pagination tool bar to “stretch” and the data table to “align left”.
  4. Now you can resize any column and the entire table resizes accordingly.
Add the title and and pagination tool bars to create the final table.

And that’s it. We just created a pretty flexible and robust data table in Figma. Because we have created components and added auto-layout where they are needed, we will be able reuse everything in future projects. This will help with consistency as well as efficiency.

Before You Go

This process has helped me in working with tables in Figma, but I am open and would love any feedback on how it could be improved further. Since every designer and project is different, the approach and techniques that I have laid out here may not work for your specific context. That’s why I’m also interested in hearing what other techniques work for you when designing data tables in Figma.

--

--