Libraries are Sketch documents with Components (Symbols, Text Styles, Color Variables and Layer Styles) that you can share across all of your other documents — and even across whole teams.
When you update Components in a Library , documents that use them will get an update notification. You can review those changes and confirm them to make sure you’re always using the most up-to-date Components in your work.
Libraries are handy for teams who work on designs that share Components like icons, UI elements or branding. But they’re just as handy if you’re an individual. With Libraries, you can quickly insert common Components (like Apple’s iOS UI elements) into your designs and be sure they’re always up to date.
Creating a Library
You can turn any regular document into a Library in a couple of different ways, depending on whether you’ve saved the original document locally or to a Cloud workspace.
You can open any local or Cloud document and choose File > Add as Library… to turn it into a Library and add it to your Libraries .
In your browser, you can hover over the document’s thumbnail in your Cloud workspace, click on the cog icon that appears, then choose Settings. In the Settings panel that opens, enable the Use as Library option to turn your Cloud document into a Library . You can now add this via Sketch’s Preferences.
Adding a Library
Open Sketch’s Preferences by choosing Sketch > Preferences (or pressing ⌘ + ,) and click on the Libraries tab. From there, you can either drag a Library Sketch document into the window, or use the Add Library… button to browse for it.
To find out more about the options in the Libraries tab, take a look at the Preferences section.
Sharing a Library
There are a few different ways to share a Library with others — using a sync service, sharing via Cloud, or uploading to a server and using RSS for updates.
Using a sync service (like Dropbox or Google Drive) to share your Library is as simple as uploading the Sketch document and sharing it with the people that need it. They’ll get a notification in Sketch any time you update it.
Using Cloud to share your Library is also simple. Simply upload your document to Sketch Cloud, open its settings, check Use as Library, then click Save Changes.
Anyone you share this Library document within Sketch Cloud can click the Add Library to Sketch button in the document’s overview to add it as a Library and receive notifications in Sketch when you update it.
Sharing a Library with a team on Cloud
If you’re part of a team, sharing and discovering Libraries is even simpler. Upload your document to your team workspace, click the cog icon to open settings, check Use as Library, then click Save Changes.
Head back to the Mac app and you’ll find all of the Cloud Libraries for any team you belong to under the Libraries tab in Preferences. You can scroll through and find the Libraries you need, and when you want to use a Library, just click Install.
Using RSS and a server to share your Library is a little more complicated. First, you’ll need to host your Library document on a server. Then, you’ll need to create an XML file like this:
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"> <channel> <title>My Sketch Library</title> <description>My Sketch Library</description> <image> <url></url> <title>My Sketch Library</title> </image> <generator>Sketch</generator> <item> <title>My Sketch Library</title> <pubDate>Wed, 23 Jun 2019 11:19:04 +0000</pubDate> <enclosure url="mysketchlibrary.sketch" type="application/octet-stream" sparkle:version="1"/> </item> </channel> </rss>
Inside the XML file, you’ll need to edit the following:
<title>— The Library’s name that you want to show in Sketch
<image><url>— The default thumbnail URL that Sketch will attempt to use for your library. It should point to a publicly accessible image URL.
<item>— The information between the item tags is what you’ll want to update when you create new versions of your library. You only need one item tag within your feed.
In the the item tag, for each update you’ll need to include:
<pubDate>— The date the library update was published in the RFC822 format.
<enclosure>— The enclosure tag has three attributes: url, type & sparkle:version. The URL should point directly to your Library document’s server location, type should be “application/octet-stream” and finally sparkle:version is a number that should increment with each new update.
Make sure to serve both your XML feed and your Sketch file using https URLs.
Finally, use a tool like the Meyerweb URL encoder to encode your XML feed URL and add it on to the following:
Enter the full URl (from
sketch:// through to the end your encoded URL) into your browser to open Sketch and add your shared Library.
Renaming a Library
If you need to rename a Library , follow these steps:
- Open Sketch’s Preferences (by choosing Sketch > Preferences or pressing ⌘ + ,) and click on the Libraries tab.
- Right click the Library you want to rename, and choose Remove Library…
- Rename the Library using Finder
- Add the Library again (see Adding Libraries)
You can browse and insert Library Symbols via the Insert Window or the Insert Menu .
To use the Insert Window, open it by pressing C or choosing Window > Insert from the Menu Bar. In the window, you’ll see all of your enabled Libraries in the left sidebar. Click on the Library you want to browse. You can also search for any Symbol using the search bar. From there, you can drag and drop any Symbol onto the Canvas.
You can also access Library Symbols from the Insert menu where, instead of the usual Symbols icon , they’ll have a link icon to show they’re part of a Library .
You’ll also find Library Symbols in the Inspector when you swap symbols.
How to Edit Library Symbols
When you double-click a Library Symbol to edit, Sketch gives you some options, depending on where the Library file has been added from.
Double-clicking to edit a Symbol that belongs to a Local Library or a Library on your Personal Cloud will present the following options:
- Open in Library will take you to the original Library document so you can edit the Symbol’s Source. This will update the Library and any documents with instances of that Symbol .
- Unlink from Library will create a local version of the Symbol so you can edit its Source in your current document. This will mean you’ll no longer get updates to that symbol if the Library it originally came from gets updated.
If you’re trying to edit a Symbol that’s part of a Team Library on Cloud you’ll see the following options:
- Open in Library will open original Library document from Cloud. Any changes made here will update the Library for your whole team and any documents with instances of that Symbol will reflect the changes.
- Unlink from Library will create a local version of the Symbol so you can edit its Source in your current document. This will mean you’ll no longer get updates to that Symbol if the Library it originally came from gets updated.
If you’re using a Library as part of a team, take extra care when editing Symbol Sources there. Any changes you make and save will be sent to everyone using that Library.
If the Symbol you want to edit belongs to a Third Party Library like the Apple iOS UI kit you’ll only have the option to Unlink from Library.
Along with Symbols you can share and sync Text and Layer Styles using Libraries. They’ll appear in the Insert Window and in the Components popover under Appearance in the Inspector. You can also access Text and Layer Styles via the Insert menu, and like Symbols, Library Styles have a link icon next to their group name to indicate they’re part of a Library .
To insert a Library style from the Insert Window, open it by pressing C or choosing Window > Insert from the Menu Bar. In the window, you’ll see all of your enabled Libraries in the left sidebar. Click on the Library to filter results or search for the Text Style , Layer Style , and Color Variable you want to insert, then drag it onto the Canvas.
How to Edit Library Styles
If you’re using a Library Style (Layer Styles or Text Styles) in your document and want to edit a Layer that uses it, you’ll have a few options to choose from in the Appearance panel in the Inspector:
- Before you make any edits, you can choose to Create a new local Style from the currently selected style. This will unlink the style from the Library and create a new local Style in your document.
- Alternatively, you can choose to Detach the Style from its Source, to unlink it from the Library but not create a new local Style.
- If you make edits to a Library Style, you can choose Create New Style and Replace to unlink it from the Library , create a new local Style and apply those changes to all layers in your document with that Style applied. Alternatively you can choose Reset Style to revert your changes.
- As long as the Style is not part of a Third Party Library, you can also choose Edit Style in Library to open the Library document that this style belongs to.
Note: Editing a Style in the original Library document will update that Style for anyone using that Library.
How to Create Library Presets
As well as Symbols , Text Styles , and Layer Styles , you can use Libraries to sync and share gradient or image fill presets. To create a Library Preset for a gradient or image fill , for example, select a gradient in the fill popover of your Library document and add it as a preset under Document Colors.
You can also create, share and sync solid colors in your Libraries using Color Variables.
Now, when you’re working in a document that uses that Library , click on the title above the presets in the fill popover and select the Library’s name to view all of the available Library Presets.
Updating Library Components
When Library Components (Symbols , Text Styles , Color Variables or Layer Styles ) you use in your document get updated, you’ll see a Library Updates Available notification in the notifications icon of Sketch’s window. Clicking on this will bring up a Component updates dialog.
Select a Component to see what’s changed and check the checkbox if you want to update it in your document. If you don’t want to update a specific Component, uncheck it. When you’re done, click Update Components.
To stop a Symbol from updating double-click any instance of it in your document and click Unlink from Library. This will create a local Symbol on your Symbols page instead.
Tip: For information how to unlink Text and Layer Styles, take a look at How to Edit Library Styles.
Create a Custom Library Thumbnail
If you want to create a custom preview for your Library , somewhere in the document, create a new 1:1 (square) Artboard and give it the name, “Library Preview”.