Overrides & Dynamic Buttons in Sketch

Giuseppe de Cesare
Design + Sketch
Published in
3 min readFeb 23, 2017

Overriding dynamic buttons and adjusting their padding in Sketch is still hard to come by. You can use different plugins, e.g. Dynamic Buttons or Modulizer but I have never figured out how to make them work with symbols.

Well, today playing around with Auto Layout plugin, with patience and luck I found a way to create a super-dooper dynamic symbol button. It’s not perfect and it requires time but it could be a good compromise until a future improvement :)

Here’s the how to:

  1. Divide your button in three parts. The body group will be resized based on the length of the label, padding left and right will wrap the button up.

2. Select all layers and create a Stacked Group leaving the spacing to 0. Of course you need to install Auto Layout before ;)

3. Select the label background and pin it to left, top, right, bottom.

4. Pin the Label layer to Center Horizontally and Center Vertically. Also, make sure it is in “Float in place” resizing mode.

5. Create a new Symbol and set its artboard width to the maximum width a button will have in your design (e.g. less than 320px for iPhone 5 screen). It’s not ideal but you’ll be able to resize it manually afterwards if you wish.

Center aligned to the artboard + pin to Center Horizontally

6. Finally align the symbol to the left, center or right to its own artboard and respectively pin it to left, center or right in the Auto Layout panel. Apply symbol overrides and enjoy :)

Left aligned to the artboard + pin to Left

Summary: it helps you save time, make padding consistent and use symbol overrides easily. What do you think? Any other trick out there? :) Hopefully Sketch will fix it soon and all these hacks will be just black on white in Medium.

Cheers

Update: this hack is older than 6 months already so it will probably not work with the latest version of Sketch and Auto Layout plugin. I trust there are better ways to create beautiful consistent buttons ;)

--

--