Consistent Design Systems in Sketch With Atomic Design and the Auto-Layout Plugin
Do you design digital products (or websites) and hand design files off to developers for implementation? If you answered yes, settle in! While the should-designers-code debate rages on, we’re going to look at how adding a methodology to your design workflow can make you faster, more consistent, and loved by all developers… even if you don’t code.
Let’s dig in!
Why a methodology?
In the development world, it seems like at least half of your career is about staying up to date with new tech and leveling up your skills. While the pace may not be quite as frantic in the design landscape as it is in development, there definitely has been a huge shift in tools over the past three years or so.
Tools like Sketch have made a lot of the old pain of working in design files a thing of the past. Smart combinations of text styles, object styles, symbols, and libraries now mean sweeping changes are just one click away. No more picking through 40 Photoshop layers to make a single color change.
Yet, sweeping color changes in a marketing landing page is no longer the biggest design challenge. Design and development teams are now expected to deliver complex interfaces loaded with interaction and conditional states… for every device available now and the next day. Working as both a designer and developer, I have seen the workflow friction from both sides.
Beyond tools, designers need an approach.
Thinking in terms of “components”
If you work in the tech space in any capacity, you have likely heard of development frameworks such as React, Angular, or Vue.
Um yeah, I’m a designer so that doesn’t really concern me, bye.
Kinda. But if you’re hoping to do design work for modern digital products, there is a pretty big chance that said products will be built using one of these frameworks. No one expects an architect to build the structures themselves, but they better have a high-level understanding of the what the tools are and how they will be used.
So here’s what you need to know about modern front-end frameworks:
They have brought on a paradigm shift for developers in which products are built by combining a series of smaller components into complex systems which can adapt to different contexts and devices. This makes the code easier to maintain, and the entire system more flexible.
For a variety of legitimate reasons, many designers have not caught on to this paradigm shift as quickly as developers. We are missing a mental model for creating the pieces that make up these interfaces independently from their environment/pages/screens/viewports etc.
One such approach is Atomic Design.
What is Atomic Design?
First coined by Brad Frost, Atomic Design is a methodology which tries to answer a simple question: if hundreds of device sizes mean we can no longer effectively design “pages,” then how do we even design?
The answer lies in breaking down everything that could make up a “page” or “view” into smaller and smaller pieces, creating a “system” of blocks which can then be recombined into an infinite number of variations for our project.
You can think of it like the ingredients in a recipe. Sure, you could make muffins, but you could just as easily make a cake with the same list of ingredients.
Brad decided to use the chemistry analogy, and so he proposes that our systems are made up of:
For the sake of simplicity, let’s take a look at how we might apply this to a website.
Atoms represent the smallest building blocks which make up our user interfaces. Imagine a form label, a form input, and a button. Each one of those represents an atom:
Molecules are simply groups of atoms combined to create something new. For our purposes, we can think of molecules as groups of disjointed UI pieces which are combined to create a meaningful component.
Organisms are made up of groups of molecules (or atoms or other organisms). These are the pieces of an interface which we might think of as a “section.” In an invoicing application, an organism could be a dashboard combining a “new invoice” button (atom), a search form (molecule), a “total open” card (molecule), and table listing overdue invoices. You get the idea.
Let’s look at what a “featured block” organism might look like in our simple website:
Using stacks for consistency
So, now that we have a mental model for the “stuff,” how do we go about creating these building blocks? Sketch is great out of the box, but the plugins available for it provide huge performance tools… just like text editors for developers. We will be using Sketch’s built-in symbols tools, as well as the amazing Stacks” feature from Anima App’s Auto-Layout plugin.
Using these tools will bring some priceless benefits which I will point out as we go, but at the very least you can count on:
- better design consistency and faster iteration
- a sanity check from using consistent spacing multipliers
- faster reordering of content
- help identifying design problems quickly and early on
What exactly are stacks?
If you’ve ever heard developers excitedly talk about flexbox for building layouts in CSS, then you can think of stacks as the Sketch equivalent. Stacks (like flexbox) allow you to group a series of layers together and then define their spacing and alignment on a vertical or horizontal axis.
Here we group three items, align them through their center, and set
48px vertical space between each one:
The layers will automatically be group into a blue folder with an icon of vertical or horizontal dots to show what kind of stack you have.
Look at that! You just learned flexbox without touching a line of code. 😂
The real power of stacks comes from nesting stacks inside other stacks:
Here, we can see a card component made up of multiple stacks:
card__ctalink from the previous example.
card__copystack which handles the alignment & space for the header and text.
card__contentwhich controls the spacing and alignment between the
A quick note about layer naming
I almost always use the BEM naming convention for my components. Developers appreciate the logic when I have to to hand off design files because it often aligns with the naming conventions they are using in code. In the case where I’m developing the project myself, it gives me a bit of a head start as I’ve started thinking about the markup at the design stage.
If that’s super confusing, don’t worry about it. Please just make your colleagues’ job a little easier by organizing your layers and giving them descriptive names.
Stacks shmacks, I have great attention to detail and can do all this manually!
You’re absolutely right! But what about when you have carefully laid out 10 items, all of varying sizes, and now they need extra space between them? Or, you need to add a line of text to one of those items? Or, you need to split content into three columns rather than four?
That never happens, right? 😱
One of two things usually happens at this stage:
- You start manually reorganizing all the things and someone’s paying for wasted time (whether it’s you or the client).
- You kinda fudge it… after all, the developer surely knows what your original intentions were before you left every margin off by a couple pixels in your layout. ¯_(ツ)_/¯
Here’s what stacks get you:
- You can change the alignment or spacing options as much as you like with a simple value adjustment and things will just magically update.
- You can resize elements without having to pick at your artboard to rejig all the things.
- You can reorder, add, or remove items from the stack folder and watch the items redistribute themselves according to your settings—just like code. 🎉
Notice how fast it is to edit content and experiment with different layouts all while maintaining consistency:
OK, so now we know why stacks are amazing, how do we actually use them?
Creating a stack is a matter of selecting two (or more) layers and hitting the stacks folder icon in the inspector. From there, you can decide if you are stacking your layers horizontally or vertically, and set the distance between the items.
Here’s an example of how we’d create an atom component using stacks:
And, now let’s apply the stacks concept to a more complex molecule component:
Creating symbols from stacks
We’ve talked about the many benefits of stacks, but we can make them even more efficient by applying Sketch’s symbol tool to them. The result we get is a stack that can be managed from one source instance and reused anywhere.
Creating an atom symbol
We can grab that call-to-action stack we just created and make it a symbol. Then, we can use overrides for the text and know that stacks will honor the spacing:
If I decide later that I want to change the space by a few pixels, I can just tweak the stack spacing on the symbol and have it update on every instance 🎉
Creating a molecule symbol
Similarly, I can group multiple stacked atoms into a component and make that into a symbol:
Symbols + stacks = 💪
Wouldn’t it be nice if we could maintain the spacial requirements we set regardless of the tweaks we might bring to them down the line? Yes!
Replacing one item with another inside a component
Let’s assume our card component now requires a button rather than a link as a call-to-action. As long as we place that button in the correct stack folder, all the pixel-nudging happens automagically:
Editing molecules and organisms on the fly 🔥
You might be thinking that this isn’t a huge deal and that adjusting the tiny spacial issue from the previous example would have taken just a moment without stacks. And you wouldn’t be wrong. But let’s refer back to our notions about atomic design for a moment, and ask what happens when we have far more complex “organisms” (groups of atoms and molecules) to deal with?
Similar to our mobile example from the beginning, this is where the built-in power of stacks really shines:
With a library of basic symbols (atoms) at our fingertips, and powerful spacing/alignment tools, we can experiment and create endless variations of components. The key is that we can do it quickly and without sacrificing design consistency.
Complex layouts and mega stacks
Keeping with the elements we have already designed, let’s see what a layer stack might look like for a simple marketing page:
Don’t let the initial impression of complexity of those stacks scare you. A non-stacked version of this artboard would not look so different aside from the color of the folder icons.
However it’s those very folders that give us all the power:
We may not need to code, but we have a responsibility to master our tools for efficiency and figure out new workflows with our developer colleagues.
This means moving away from thinking of design in the context of pages, and creating collections of components… modules… ingredients… legos… figure out a metaphor that works for you and then make sure the whole team shares the vocabulary.
Once we do this, issues around workflow and collaboration melt away:
Speed and Flexibility
Carefully building components with symbols and using automated and consistent spacing/alignment with stacks does require a bit of time investment upfront. However, the return of easy experimentation and ability to change course quickly and at low cost is well worth it.
Consistency and UX
Having to think about how elements work as combinations and in different contexts will catch UX-smells early and expose issues around consistency before you’re 13 screens in. Changing direction by adjusting a few variables/components/spacing units beats nudging elements around an artboard all day.
Responsibility and Governance
1440px page view of the thing you are building simply does not provided a developer with enough context for multiple screens and interaction. At the same time, crafting multiple high fidelity comps one tiny element at a time is a budget buster (and this is particularly true of app designs). So, what tends to happen on small teams? The developer gets the one gorgeous
1440px view… aaaaand all the cognitive overhead of filling in the gaps for everything else.
Providing the details is our job.
Atomic design gave us speed, creative freedom, and flexibility. It changed everything.”
—From the forward of Atomic Design
The post Consistent Design Systems in Sketch With Atomic Design and the Auto-Layout Plugin appeared first on CSS-Tricks.