How to build a component Library in Sketch

Share

If you’re finding yourself copying and pasting the same Symbol between documents, or keeping Post-it notes with hex codes next to your monitor, it’s probably time to turn those core components of your design into a Library.

In this post, we’ll walk you through how to create a Library and all the components you can add to it. Let’s get started!

Let’s get started!

How to create a Library

With Libraries, you can organize and store your components in one place and even make them accessible across your Workspace. They’re useful for easily applying your branding across different scenarios or even splitting up larger design docs with common elements. In other words, Libraries give keep things consistent and improve collaboration within your team.

You can turn any document into a Library in Sketch by using File > Add as Library. In the web app, you can turn existing documents into a Library via document settings.

You can learn more about Libraries with our free Sketch 102 course — and so much more!

While it’s quick and easy to convert an existing document into a Library, sometimes it makes sense to start from scratch, especially if you haven’t created components already. And if you’re starting from scratch, it helps to add components in an order that makes sense.

A good way to think about Library components is in three levels of complexity. Let’s look at each level and the components that are a part of them.

Level 1: Basic components

If you’re building a Library from the ground up, we’d recommend starting with the fundamental building blocks of styles and colors.

Here’s your component starter pack in Sketch 👇

Color Variables

Color Variables are useful for storing colors. They’ll show up right in the color picker, making them easy to find and apply. You can use them to create a color palette for your brand or project, which will help you work faster and keep your designs consistent.

Text Styles

When it comes to working with typography, Text Styles are your best friends. You can create predetermined combinations of fonts, weights, and colors that you can reuse across your designs. This way, you can create different Text Styles for headings, subheadings, and body copy and avoid copying and pasting styles across documents.

Layer Styles

Layer Styles work in the same way as Text Styles, except that they apply to shape layers. You can use them to save background colors and shadows. For example, you might have a specific setup of shadows for buttons to give them a subtle glow or 3D effect. If you want to keep this treatment consistent across your designs, you can save these layers as Styles.

How it all comes together

You can easily swap between styles and colors depending on the context. Maybe you want to use two Color Variables to differentiate between active and inactive buttons. Or you might want to change Text Styles for copy of varying lengths or prominence.

You can quickly access Color Variables and styles through the Components view, which you can trigger by pressing C in the Mac app. From here, you can drag them drop them right onto layers you want to apply them to.

Once you’ve got your basic components ready, you can start working on more complex elements.

Level 2: Symbols and Nested Symbols

Now you’ve got your building blocks in place, it’s time to make use of them with some more complex components — Symbols and Nested Symbols. Let’s take a look at how each of them works and what you can use them for.

Symbols

Symbols are the core of any Library in Sketch, and are especially handy for working with elements like navigation bars, logos and modules. In technical terms, Symbols are a special type of Artboard that contains layers that can be re-used and updated. You can replicate this group of layers infinitely across your project and edit them however you prefer. You can make individual changes to a specific instance or update all of them at once by editing the Source.

For example, let’s say you want to design a button to reuse across an app project. You can create the shape layer and text layers and save it as a Symbol. Then, you can start adding instances of that Symbol all over your design. If you need to make a change to the overall look of the button, you can do so through the Symbol Source. Or, you can edit a specific instance and change the color or copy without affecting the rest of the buttons.

New to Symbols? You’re in for a treat. We’ve recently written about the benefits of working with Symbols in Sketch, and how to incorporate Symbols into your workflow if you want to get up to speed.

Nested Symbols

With Nested Symbols, you can place simple Symbols (like a button or logo) inside a larger one, such as a navigation bar. This extra layer of complexity — almost like a Level 2.5 — gives you a lot of flexibility when editing. You can tweak each piece individually while keeping everything in sync. For example, if decide to update your logo, it will also change within the navigation bar.

How it all comes together

This is where applying Styles and Color Variables to your Symbols comes in handy. If you take the time to set them up, you can change the entire look and feel of an app’s design in seconds. The more you rely on Text Styles, Layer Styles and Color Variables the easier it will become to manage and scale your Library.

Level 3: Artboard Templates

With Artboard Templates, you can turn any Artboard and its content into a reusable component. They’re perfect for holding your Symbols and overall design for screens, profiles, posts, and all sorts of mockups.

All you have to do is select the Artboard and enable the Use as Template checkbox in the Inspector. Then, you’ll be able to access your new Artboard Template through the dropdown in the Inspector after pressing A or in the Components window.

Not sure when to use Artboard Templates? Imagine you’re working on a new web design and you’ve just finished putting together the header and footer you’ll be using in most of the screens. You can create an Artboard with the same dimensions as your screen, add in the header and footer symbols and save it as a Template. This way, you’ll save a step every time you create a new screen for the app since the headers and footers will already be in place.

Pro Tip: You can also use Artboard Templates to create guides for yourself and your team. Think screen sizes, margins or even sketches that can help jumpstart a project or design.

How it all comes together

Once you have all of your components carefully woven into your Artboard Template, making changes and keeping things consistent will be near automatic. A simple change to a Color Variable will ripple across Symbols and Artboard Templates, while still retaining full control over making individual changes where necessary.

What’s more, a well-crafted Library can be easily turned into a fully-functional design system, provided you add some more instruction for your team. We have a whole guide on how to build a design system you can check out if you’re looking to dive deeper.

And there you have it! If you want to learn more about Libraries, we have an in-depth post ready for you.

Learn more about LibrariesTry it out in Sketch