Hey there, welcome to the second tutorial on How to use Smart Layout in Sketch 58. In the first one I showed you how to set up Smart Layout in order to create a Navigation & Dropdown Menu. You can check it out here.
In this tutorial I’d like to show you how to use Smart Layout in order to create cards.
What is Smart Layout?
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.
Ok let’s get into it.
In our vertical card we want to override the content of the headline and the description. As you can see Smart Layout updates the layout accordingly to the content while it’s keeping the spacings consinstent.
Here is how my basic setup looks like. (Random Image, Headline, Description, Background of the Card). I have also increased the width of my text layer so it fits more content, by doing so it will be set to Auto Height (properties panel on the right side).
Next we want to select all of the layers and create a Symbol. Make sure to set the Smart Layout options to Top to Bottom Layout.
In your Symbols Page make sure to set the resizing options of your Image to Fix Size.
Otherwise the image will be resized as well, we don’t want to make it look like this:
Now go to Page and try to override the content of your Card. As you can see it is already extending the entire Symbol even though the text copy hasn’t passed the height of the image. We want to fix this in order to let Smart Layout only extend the Layer if the text passes the height of the image.
To fix this we need to group the image, headline and description. (do this in your Card Symbol). Now Smart Layout will know not to extend the entire Symbol until the copy passes the height of the group.
That’s it. You should have something similar to this.
Vertical Card Part 2
Sometimes we want to cross sell or feature another product (“you might like this cool plant as well”) but somebody decides that we should get rid off the image. Instead of creating a new Symbol we can use Smart Layout to help us with that.
This is what we’re going to build:
This is how my setup looks like (Image by Chris Lee from Unsplash, 2 Textlayers and a Background. Make sure to expand the width of the Textlayers so they are set to Auto Height.
Next select all of your layers and create a Symbol (choose Top to Bottom Layout for Smart Layout)
In your Symbols Page make sure to set the Resizing options of the Image to Fix Size.
Next create a Symbol for your Image.
Next select both of your Text Layers (Headline & Description) and create a Symbol, set the Smart Layout options to Top to Bottom Layout.
You should end up with something like this:
Next we’re going to select the Image and Content Symbol and group them (CMD + G). We’re also going to apply the following Smart Layout options to the group: Horizontal — Left to right Layout.
And that’s it. Now you should be able to override the Headline and Description (Smart Layout will also know not to extend the entire Symbol until the copy passes the height of the group) and set the Image to None (in your Overrides) it will update the design accordingly.
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 the online course I’m working on: https://sketch-masterclass.com