5

So Sketch has symbols. These are great if every instance of the symbol across your various artboards is exactly the same. But what if say you had a tab bar, and on different screens, you wanted to show a different tab highlighted/selected? I've been just having the tab bar as an individual element, not a symbol, and manually changing the tabs for each page to show the right tab selected. I feel like there is a better way to do this, as when the client changes their mind about a colour, I'd have to individually change every instance.

2 Answers 2

4

There's a plugin called state machine that solves your task.
Article: https://medium.com/evil-martians/state-machine-3337b8776b49#.ysgrd1b2e
Plugin Download: https://github.com/romashamin/statemachine-sketch

I don't know if you're familiar with sketch plugins. Sketch toolbox is a good way for managing plugins. http://sketchtoolbox.com/

3

Nested symbols can help you out here.

Make your tab bar with all tabs in the same state, e.g default.

Create a symbol from it - TabBar/Default

In the symbol page, insert an instance of the TabBar/Default symbol (not a copy) for each tab.

Make an active state for tab 1, position over one of these instances, and create a new symbol - TabBar/Tab1_active

Repeat for each tab.

If you later need to change the colour of the tab bar background, this now only needs to be done in TabBar/Default.

Example of nested symbols in Sketch

If possible, using styles or symbols for the Active tab can reduce effort for changes too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.