Easily Create Adaptive Buttons Using Sketch’s Smart Layout

Travis Folck
Oct 21, 2019 · 3 min read

With the introduction of Smart Layout in Sketch 58, we can finally build adaptable symbols without the hacks, plugins or workarounds.

It is ridiculously easy to create adaptable buttons with Sketch 58 or above.

To see how easy it is, let’s recreate the buttons from my article Create Adaptive Buttons Using Combined Shapes In Sketch but by using the Smart Layout feature, instead.

Image for post
Image for post
Example of the buttons that we will be creating in this tutorial, using Smart Layout feature that was introduced in Sketch 58.

⬇︎Download the Sketch file

Create the symbol

Any art board size can be used, we’ll create an art board large enough to hold a solid OK button and text-only Cancel button. Create a new art board and covert to a symbol.

Image for post
Image for post

Add the button surface layer

Add a rectangle shape for the solid color button. We give it a fixed width to prevent it from changing if button row symbol is resized. Pin the button to the right side of the art board. For this example, the color #6200EE was used.

Image for post
Image for post

Add the text layer

Add text for the solid color and text button. Pin the text to the right side of the art board, give them a fixed width and make the text right-aligned. Label them Solid Button Text and Text Button, respectively .

Image for post
Image for post

Modify the art board properties

Now the secret sauce. Click on the art board, in the Inspector Panel, change the layout to Horizontal and Right to Left. This will make the text and solid button expand when override text is entered.

Image for post
Image for post

Buttons complete!

You now have a button row that will adapt to the text length. This symbol can be used on its own or nested in other symbols. Added bonus: starting with Sketch 58, you can modify the text inline by clicking on it.

Image for post
Image for post

⬇︎Download the Sketch file

Design + Sketch

The best collection of articles, tips, tutorials, and…

Travis Folck

Written by

I love technology and design. I find great satisfaction when they come together to create a great experience.

Design + Sketch

The best collection of articles, tips, tutorials, and stories on designing and prototyping with Sketch and beyond

Travis Folck

Written by

I love technology and design. I find great satisfaction when they come together to create a great experience.

Design + Sketch

The best collection of articles, tips, tutorials, and stories on designing and prototyping with Sketch and beyond

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store