A Case for Iconfonts in Sketch
✋ I KNOW, I KNOW Iconfonts aren’t cool anymore, but hear me out.
Sketch’s symbols are getting better with every update, but they still have their limitations. Text overrides are great, and I think we are all hoping for a similar functionality for layer properties and assets that live inside of the symbol. In the meantime here is a little trick I use.
Text Overrides + Iconfonts = Dynamic Icons
It’s a bit of a hack but we can actually take advantage of text overrides and iconfonts to swap out icons on the fly within symbols.
Here is a typical symbol for a list item, text overrides give us the ability to swap out the text, but you can not change any other elements within the symbol.
If we swap out the vector icon for text fields we can use an iconfont in the override field.
For this example I am using the Material Design Iconfont, which I have installed locally. Material icons are great because they are pixel fitted to whatever font size you select, and their character code is the actual icon name. They also have a big selection that is great for quick mockups.
Material icons are beautifully crafted, delightful, and easy to use in your web, Android, and iOS projects.design.google.com
The actual font can be downloaded here:
Start by defining the location of your icon within the symbol, we will use a 24x24 box.
Add a new textfield, and set the text to ‘folder’ for now.
Set Typeface to Material Icons, Size to 24, center align and set Width to Fixed.
💥 Boom, We have an icon! Be sure to align the bounding box to your guide.
You can change the name of the text layer to “Primary Icon”, so text override field is named correctly
Now if we go back to our artboard we can see a new override field for the icon.
Note: If you are using a font other than the material design font you can copy and paste from fontbook. It will not show up correctly in the preview field, but it will work in the symbol.
🔥 Taking it a step further — Data Populators!
Ok so that was cool, but what else can we do?
With a little JSON and The Invision Craft plugin we can design with data.
Download Craft, a free suite of tools for Sketch and Photoshop that let you design with real data in mind.www.invisionapp.com
Map your data within the symbol.
Now go back to your artboard and use the Craft Duplicate tool.
The purpose of this article is not to promote the use of iconfonts in your final product. But to simply speed up your design workflow. It’s a great way to add more fidelity to your wireframes and mockups.
- If you are sharing your files with other designers, they will also need the font files installed locally as well.
- If you hand off your sketch files to Devs, or use an app like zeplin. Be sure to explain the iconfont is for mockups only.