Smarter Tables with Sketch + Paddy

Table views are often a necessary evil in product design and design systems, but using tips and some helpful plugins, we can build a template that will do a lot of the heavy lifting for you in the future.

I recently introduced the new plugin Paddy to my Sketch workflow and have been excited to find more and more ways to make smarter symbols and components. If you aren’t familiar with Paddy, you should check it out here and read through their documentation. You will need to download and install Paddy in order to follow along with this tutorial.

Here is a link to the Sketch file created from the tutorial, if you need to reference it (or just want to skip to the end).

1. Building Your Cell Symbol

Cell symbol padding + layer structure.

The cell is the smallest component you will integrate into the table, so it is important to start there. We will be using Paddy’s custom layer naming attributes to help create a smarter, auto-resizing cell.

1 — First Steps
Create a rectangular shape with it’s height equal to your intended row height and a width of around 120px and name it cellBackground. Now add a new text shape within the rectangle and rename this layer to cellText.

Group these two layer’s together and name it table / cell / standard. This naming structure helps organize your symbol list and allows you to fork the symbol and create different non-standard cell symbols and table elements.

Resize the cellText layer to be 12px (or your padding of choice) from the left and right side of the cellBackground. Additionally, set the cellText layer’s resizing options to pin to the left, right, and top edge. This forces your cell to maintain a fixed column width inside your table and allows the text to wrap to a second line.

Finally, create a new symbol from them by selecting the group and going to Layer > Create Symbol. Double-click the symbol to jump to the symbol editing page to continue with the next step.

2 — Setting Up ‘Paddy’ Padding Values
The cell background shape will use Paddy to maintain specified margins around the text. Select your cellText layer and navigate to the Plugins > Paddy > Imply Padding for Selection You will notice that a string of values will be added to your cellBackground . Depending on your cellText padding from each side, you may end up with 2-4 values in between square brackets ([]). These follow traditional CSS padding order of [top right bottom left]. Reference Paddy's documentation for more info on these attributes.

Ignore Left & Right Padding

Now we want to edit those preset padding values. We want to replace the left and right padding values with x. This tells Paddy to ignore padding for those edges, which stops our cell from resizing automatically when we define our column widths in a table.

Cell Minimum Height

We will also attach a minimum height value to the cellBackground layer that is equal to your cell’s height. We will do this by adding appending ;h >= YOURCELLHEIGHT after your padding values on the cellBackground layer name.

3 — Testing the Symbol
Now that you have the cell symbol created, insert it into one of your artboards and test the Symbol Overrides to be sure Paddy is working properly. You may need to Enable Automatic Updating in Paddy's plugin preferences.

Enable automatic updating!

Inside your newly placed cell symbol, try inserting a long string of text. You should see the symbol automatically grow in height to allow for the text to wrap. Now resize the width of the cell to fit the text on one line. Pretty handy, right?

Testing our newly designed cell

2. Merging Cells into a Table Row

Table Row Layer Structure

Now that we have our bulletproof cell symbol created, let's use them to create our first table row. We will be using Paddy's 'Spacing and Distribution' features to keep our cells tightly aligned. This feature allows you add spacing and distribution properties to a parent group and have those settings affect its children. You can do this on both a horizontal and vertical axis, but for now we will be focused on the horizontal axis in order to distribute cell items evenly across our table row.

1 —Setting Up Your Data

Insert a few (try at least four) cell symbols into an artboard and fill in some dummy text data. Feel free to make the cells variable in width depending on the data you want to use. In our case, I will create a basic table listing of user data including: name, job title, email, and phone number. This is also a good opportunity to rename your layers to reference the data they hold.

2 — Adding ‘Paddy’ Parameters

Once you have your cells placed in a row, create a group from them and name it tableRow [0h t]. The [0h] in the group name refers to Paddy's horizontal distribution property. The 0 means that each cell will have 0px of padding between each and the h refers to the direction to distribute the children (cells). Play around with this value and see what it reproduces. The t simply refers to the alignment of the cells. This tells each cell to align to the top of the group.

Table Row ‘Paddy’ Parameters

You may not immediately notice a huge benefit from this Paddy property, but try removing the job title cell from your tableRow. What happens? You can do the same thing when adding new cells. Try duplicating the email field? The cell should fill inline with the rest of the cells and adjust the spacing of the surrounding cell to match. If you try to drag a cell out of place, what happens? Pretty cool. You can refer to Paddy documentation for all short codes and other spacing, distribution, and alignment properties.

Additionally, in order to support dynamic resizing of row height, we should create a rectangle that matches your cell background color and set it’s layer name to tableRowBackground [0]. Be sure you place this inside your recently created tableRow group. I also recommend locking the new shape, so you do not inadvertently select it. Refer to the screenshot above for structure.

3. Create Table Headings

Similar layout to our cell symbol

Now that we have our first full table row built out, we can now move on to creating proper headings for each of these cell columns. This should be a very familar process to the first steps.

1 — Create a New Heading Symbol

The first thing we will do is navigate back to our Symbols page and duplicate our cell symbol from earlier. Rename this new symbol table / heading / standard.

The table / heading maintains the same structure as your duplicated cell symbol. The only difference will be the styling of the text layer inside the symbol. Take the time to style your heading text however you choose, but try to maintain the same symbol width as your cell to allow for easy symbol swapping later.

You can also use this as an opportunity to differentiate your heading component by adjusting the background color, adding a bottom stroke (inner shadow), or removing the background fill entirely. I chose to do the latter.

Now we will head back over to our primary artboard where we will create our table heading row.

Process for Adding Table Headings

2— Adding Table Headings Row

The easiest way to do this is to create a copy of our existing tableRow and move it directly above our first row of cells.

Now select all existing cell symbols in the newly duplicated row and swap their symbol to our new heading cell. 💡 Tip – Holding Cmd + Shift let’s you multi-select while also clicking through top-level folders.

You can then update all the heading text content to match their appropriate column data. You may also want to update the layer naming to reflect these changes.

4. Build Our Final Table

Table with multiple rows maintained with Paddy

The last thing we will do is utilize Paddy’s spacing and distribution features we learned earlier to build a fully flexible table with multiple rows.

Start by selecting your tableRow with headings as well as your single tableRow and grouping them together. Name this group table [0v l]. This tells Paddy to align all children of the group vertically (v) with 0px of padding between each child, while also keeping each child aligned to the left side.

Now, simply select the tableRow and hit Cmd+D any number of times to duplicate it. You may need to hit Esc or Enter to be sure you have unselected your row and Paddy auto-updates your layout.

🎊 Voila! You should see each of those newly created rows populate directly below the original and maintain the strict left alignment and spacing.

Now feel free to experiment with this table by copying a row inline, adjusting the vertical spacing on the table layer, deleting a row, resizing the table, and more. Below are a few GIFs of the table in use to demonstrate the various ways in which Paddy helps our table respond to different actions.

Responsive Cell Height + Text Wrap
Responsive Column Width
Inline Row Duplication
Inline Row Deletion
Inline Row Reorder
Dynamic Vertical Padding on Table Rows

I hope this tutorial was helpful in learning more about Paddy and the ways it can enhance your product design workflow. Please share your thoughts, ideas, and improvements in the comments. Huge props to @davidwilliames for creating Paddy (among other great plugins). Share your support of his work in the form of a ☕ or 🍺 via PayPal.