Smart Layout in Sketch 58 💥
With Smart Layout, Sketch is making Symbols more powerful and supercharging your workflow when it comes to using them in your designs. With it, you can set a direction for Symbols to resize when you change their overrides, while keeping the spacing between different layers in that Symbol consistent.
In this article, I would like to show you how to use the Smart Layout options in Symbols & Nested Symbols.
We’re going to create a Navigation & Dropdown Menu.
What happens a lot when designing a Navigation Menu is that you want to override the content of a label, in the old Sketch we needed to resize each item and reposition them. Thanks to Smart Layout we can easily override the label and it will update the layout accordingly, it also keeps the spacings within the Menu item and within the Navigation Menu. The cool thing is that we can also get rid of particular menu items and it will still update the layout. 🥰 This is what we’re going to build:
Navigation Menu Setup
For this example we will need to set up two buttons. Create a Symbol for each of them and pick Left to Right Layout in the Dropdown Menu.
The setup in the Symbols Page looks like this:
Next Insert as many Button Symbols as you’d like to have in your Navigation Menu, we do this in the Page.
Now we need to select all of the Buttons and create a Symbol for the Navigation Menu, select Left to Right Layout in the Smart Layout options.
We can now override the Label of each button, as you can see it keeps the spacings and aligns the Symbol perfectly. In the overrides panel we can also set a particular button Symbol to none, and it will update the Navigation Menu. This works because we can set Smart Layout options for Symbols (Navigation Menu), Nested Symbols (Button) and even Groups within Symbols.
Sometimes some of the Dropdown Menu items in our design won’t be needed or we would like to get rid of the icon in one of these items (if you have any icons). In order to create a Symbol for each type of design we can set up Smart Layout which will do the job for us. This is what we’re going to build:
First we need to set up the item Symbol, as you can see it contains of a rectangle (as bounding box), Text Label, and Icon Symbol. Create the Symbol and set Smart Layout to Horizontal, Left to Right.
Now go back to your page and insert the Symbol as many times as you want, you can also create a background for the dropdown menu if you want. Make sure everything is aligned, you can use the Tidy feature in Sketch to do so. Now select all of your layers and create a Symbol for the Dropdown Menu, set Smart Layout to Vertical, Top to Bottom.
Now go back to your Page and test if everything works by setting the overrides of an item to none as you can see the layout will be updated perfectly. You can do the same with icons. This works because we can set Smart Layout for Symbols (in this case Dropdown Menu), Nested Symbols (in this case Item & Icon) and Groups.
As you can see it is pretty easy to use Smart Layout in Sketch 58 and you can do a lot with it. I hope this tutorial was helpful for you, if you have any questions please feel free to leave me a comment. ✌🏻
If you’d like to learn how to master Sketch, make sure to check out my online course I’m working on: https://sketch-masterclass.com