When you’re working on mockups or prototypes you’ll probably want to populate your designs with images and text to visualize the finished product. With Sketch’s Data feature you can quickly add real text and image data to your designs and update them, in an instant.
Sketch allows you to insert two types of data, images and text. Bundled inside Sketch are image data sources for a selection of diverse user photos for avatars, tiles (patterns), and images straight from Unsplash. The app also includes two built in text data sources—names and world cities.
On top of that, you can add your own images, text, and even plugins to help populate your designs with realistic data!
You can add image data to any selected shape layer, or text data to any selected text layer. To do this, make sure you have the layer you want to apply data to selected, then choose your source from the Data toolbar icon, or select it from Layer › Data in the menu.
You will see that a new image fill has been applied with a random image on shape layers, or the text content has updated with a random value on text layers.
If you don’t like what has been selected, or you wish to test your design with more data, from the Data menu choose “Refresh Data” or press Command-Shift-D.
If you want to remove the connection to a data source on a layer, you can clear the connection by choosing “Clear Data” from the Data menu. This will remove the connection but won’t restore the original layer content.
You can also add text and image data to Symbols, which allows you to refresh multiple Data sources at once when an instance is selected, using Command-Shift-D, so you can easily create reusable UI elements whose content can be updated with a single shortcut.
Data layers inside Symbols, will appear in the overrides panel in the Inspector with a small, purple, Data icon next to them.
You can refresh individual Data layers within a Symbol, by clicking on the Data icon next to the Layer name in the overrides panel and choosing “Refresh Data”, or you can select a new source of data.
Adding New Data
You can add your own data by simply creating a
.TXT document, or a folder of images you would like to use, and adding it as a data source in the Data pane in Preferences. Check out that page where you can find out about some extra tips and best practices.
Alongside the ability to add text files and image folders to insert data into Sketch, data plugins opens up many more possibilities!
The Unsplash plugin that is included inside Sketch is a great example, where you can add stunning images from Unsplash’s expansive, royalty free image library, right inside your documents. You can also add keywords to generate more specific images.
If you want to start building your own plugins that work with Data, check out this handy guide.