More Flexibility with Buttons in Sketch

Using nested Symbols and Relabel Button Plugin

Wolfram
Design + Sketch
4 min readFeb 27, 2017

--

Whether you design a small App or a full-fledged web portal — buttons are everywhere. Luckily we can use Symbols to keep our workflow DRY. But even if you have only 3 different types of buttons you likely end up having more than 30 Symbols, considering all the different colours and states. Wouldn’t it be nice to only have one Symbol for all buttons?

Thanks to Jon Moore and Alberto Orsini one can learn how to use Nested Symbols to achieve exactly that.

Well, I don’t want to repeat these articles so I will just summarise a few things. This is basically how the Nested Button Symbol is structured:

Text Layer: The label of your Button
This is a Symbol

State Layer: Normal, Hover, Pressed, Focused, Disabled etc..
This is a Symbol

Colour Layer: Primary Color, Secondary Color etc…
This is a Symbol

Base Layer: The shape of your Button
This is a mask for the Layers above

Shadow Layer: Shadow Types
This is a Symbol

I keep a shadow Layer at the bottom of the stack. This way I can change the shadow independent of the Button State Layer.

This is how I structure the nested Symbol

Pro Tip:

Make sure that symbols of the same category have the same size. For example all my Colour Symbols are 100px x 100px, while all my shadow Symbols are 100px x 50px. That way only the symbols that you actually need will show up in the respective drop down panel.

I have been using this technique for some time now and came to the conclusion that it doesn't answer one main question —

How can I change the text in the button while maintaining the padding?

Enter: Relabel button Plugin

In an earlier article I wrote about how awesome this plugin is. And again, in combination with this technique, it proves itself to be indispensable.

All I do differently from the method described in above articles is, that I keep the Text Layer separate from the Button Symbol.

I create a new Group with the Button Symbol and the Text Layer. For changing the Text Color I use Text Styles.

And now, using the Relabel Button Plugin, I can change the Label to whatever I want without losing my padding.

The Relabel Button Plugin Input Dialog
I am still in control of all nested Symbol overrides

Check out the Gif where I show how it works…

Buttons with Icons

You can use the same technique for buttons with Icons as well. It doesn't matter on which side of the Label you put your Icon. The Plugin works both ways.

The Button stays the same and I use the same color symbols for the Icons.

Pro Tip:

I am using a nested overrides for icons as well. The Icon is a mask for the same Color Symbols I am using across the file. First introduced by Francesco Bertocci in this article. For an advanced understanding of this functionality, check out the article below by Jon Moore.

Conclusions

It took me quite a while to get this right, but if you want to stay in control of your margins then this is a good way to do it. Especially when developing Style Guides it saves a huge amount of time if you set up your Symbols properly.

Another great read on organising Symbols by Lloyd Humphreys:

If you have better ways of doing things in sketch do let me know.

Find more of our writing on our blog.

If you found this article useful, please hit the 💚 below so that it can reach more people.

--

--