How to Make Buttons in Sketch

This is an update to my original article!

Before you start reading, download the free source file!

My first button article was pretty popular, so I figured I’d revisit it since things have changed significantly (for the better) in Sketch.

When Sketch released version 52, they unleashed style overrides into the world. This meant that if you constructed a symbol using layer styles and/or text styles, you could override those styles with other styles.

The header of this article was designed using just THREE symbols:

  1. Button with no icons
  2. Button with an icon on the left
  3. Button with an icon on the right

The trick to making a completely variable button symbol is styles and some clever nested symbols for driving the shape of the button.

Our new and improved button symbol is composed of two layers:

  1. Text Layer: This is the text of the button
  2. Shape Symbol: This determines the shape and color of the button

 

The Text Layer

The text layer is pretty simple…all we have to remember is to assign our text layer one of our saved text styles:

 

 

To make sure the padding around our button text stays consistent, I like to set the text layer to “Fixed Width”, then pin the left and right edges. Fixing the height will also allow you to resize the button vertically and keep the text in the vertical center:

 

Jon, why not use the Padding feature of Auto Layout by Anima App?

The padding feature is
AMAZING, don’t get me wrong. But sometimes I like making modals with a footer button that stretches the width of the container, and if my button was constructed using the padding feature of Auto Layout, then I won’t be able to stretch it…it’ll keep resizing itself smaller to tightly wrap the text based on the left/right padding I defined. It’s a personal preference, so feel free to use it if you want! Alternately, you could just make two symbols: one with the padding feature, and one without. This will give you the benefit of auto-padding AND the flexibility of a fully-variable width button. You’ll just have to make sure you keep those two button symbols in sync with each other if you make any stylistic updates.

The Shape Layer

The shape layer is where we get a little bit fancy, but it’s really nothing special. It’s just a rectangle with whatever border radii you want, and a layer style applied to it. Couldn’t be easier if grandma did it herself:

 

The trick here is that since we’ve applied a layer style, we’ll be able to override the color/style in our button instances later. And since the whole shebang is nested in our button symbol, we’re gonna be able to change the shape of our button, too! So go wild with your button shapes! DO YOUR THING.

 

Sooooo here’s the thing. That’s the easy part.

The tedious part is making all of those styles. But honestly, it’s not that bad. Check out this article over here for some help:

How to Automate Creating Text Styles and Layer Styles in Sketch

Download the Source File

I took the liberty of painstakingly creating all of those text styles and layer styles and button symbols and everything else for you. Feel free to download the file and follow along. Or don’t follow along at all, and just download the file for free. Live your life, Karen.

Download the Complete Design System

This button system, plus hundreds of other components are included in the full UX Power Tools design system starter kit.