Mastering the art of code-aligned UI kits

A presentation at Figma Schema in October 2021 in by Jan Toman

Slide 1

Slide 1

Mastering the art of crafting code-aligned UI kits Jan Toman Design System Lead,
 Productboard logo

Slide 2

Slide 2

Jan Toman Design System Lead @HonzaTmn We’re hiring! Productboard helps product managers understand what customers need, prioritize what to build next, and rally everyone around the roadmap. Previously working at

Slide 3

Slide 3

Let’s talk about design systems

Slide 4

Slide 4

Design systems Design Tokens Guidelines UI Kit Reference Site Component Library (Documentation) Source & assets: SuperFriendly

Slide 5

Slide 5

Design Tokens UI Kit Reference Site Component Library (Documentation) Source & assets: SuperFriendly

Slide 6

Slide 6

Design Tokens UI Kit Reference Site Component Library (Documentation) Source & assets: SuperFriendly

Slide 7

Slide 7

What will we learn today? How component API choices affect usability Making changes (and not breaking things) Aligning Figma with code

Slide 8

Slide 8

How component API choices affect usability

Slide 9

Slide 9

What’s component API? The way each component can be controlled and configured.

Slide 10

Slide 10

Component API in React

Slide 11

Slide 11

Component API in Figma The way each component can be controlled and configured. Layers Variant controls ️Not to confuse with Figma REST or Plugin API!

Slide 12

Slide 12

Component API example: AlertBanner Describe your message A longer message description, that could stretch up to more lines when needed. Like this one, for example. message action Layers second action Variant controls Previews in assets panel

Slide 13

Slide 13

Designing APIs for components that only I will use is a completely different discipline than creating components that are understandable to people who will only use our design system.

Slide 14

Slide 14

API approach #1 – Optimized for me All variants we need Consumer using a component Our component definiton Benefits Cons Simple for maintenanc Need to know aspects of visual languag More visual flexibility Need for “how to use” guidelin More cognitive load for chang It will lead to inconsistencies (eventually)

Slide 15

Slide 15

API approach #2 – Optimized for others All variants we need Our component definiton Benefits Consumer using a component Cons It’s clear what’s supporte Harder for maintenanc Intuitive component AP Possibly larger library size No need to know design languag Less cognitive loa No room for incosistenc Centralized control over visual look

Slide 16

Slide 16

UI kit maintainer UI kit consumer Knowing all components and variants in the system Yes No The inner structure of each component Yes No Deep knowledge of visual language Yes Some Mastery in all the Figma quirks & hacks Yes Some

Slide 17

Slide 17

UI kit maintainer Now UI kit consumer After a while Knowing all components and variants in the system Yes → Fading No The inner structure of each component Yes → No No Deep knowledge of visual language Yes → Fading Some Mastery in all the Figma quirks & hacks Yes → Yes Some

Slide 18

Slide 18

How should we design API for our UI kit components in Figma? Should it be flexible or constrained? Will consumers need to know details of product visual language? What is API approach for our code components? Will it be used only be me, or also by others?

Slide 19

Slide 19

2 Design Systems Designers (one until August 2021)

Slide 20

Slide 20

2 Design Systems Designers (one until August 2021) 35 weekly active editors on our Figma plan

Slide 21

Slide 21

UI kit maintainers vs. consumers 1 Design System Designer : ~18 Product Designers UX Writers Design Managers Product Managers Content Editors …

Slide 22

Slide 22

If we’re able to save at least 10 seconds everytime a consumer uses a component from our UI kit, it’s more important to optimize our UI kit for usability rather than maintainability.

Slide 23

Slide 23

How might we create UI kits that… …designers will love using? …won’t break with future changes? …will be aligned with code?

Slide 24

Slide 24

How might we create UI kits that… …designers will love using?

Slide 25

Slide 25

Have each distinctive variant as a separate component Almighty button Having button types as variants would require more cognitive load for designers when looking for a specific button. It will improve discoverability of all distinctive variants in the system and speeds up the work with UI kit. don’t It’s slow to select the right button ButtonIntegration ButtonFloatingAction ButtonPrimary ButtonThin ButtonFlat ButtonGray ButtonSecondary ButtonDanger The better way It’s much faster for users

Slide 26

Slide 26

When to consider splitting variants into more components? Some properties are not applicable to all component variants Primary Danger Ghost ButtonPrimary Some key variants are more commonly used by consumers ButtonDanger ButtonGhost 200+ Variants Some common variants have visually distinctive types or different use cases 24 Variants Some variant property causes large number of permutations 64 Variants

Slide 27

Slide 27

Set the most frequent variant as default Is centered tooltip the most commonly used? Are people using the small buttons the most often?

Having it as a default variant saves clicks everytime when a designer needs to use it.

Slide 28

Slide 28

Defined in UI kit: different Table Cells + Table Columns Provide common presets for complex components Tables are great example of very complex component. It’s hard to use for designers, plus there is no good support from Figma to handle tables. How might we make it easier for designers to compose tables? When used by consumers: effective way to compose tables

Slide 29

Slide 29

How might we create UI kits that… …designers will love using? …won’t break with future changes?

Slide 30

Slide 30

Slide 31

Slide 31

Designers often don’t update the library because they’re afraid that their designs and prototypes will break with the update. Source: https://twitter.com/joeyabanks/status/1405169039161319427

Slide 32

Slide 32

Resetting overrides Before update After update

Slide 33

Slide 33

Visual breaking change Search features or add new iOS Platform Android Platform Web Marketing Product show hidden Search features or add new iOS Platform Android Platform Web Marketing Product show hidden Different size Before update After update

Slide 34

Slide 34

Also visual breaking change Search features or add new iOS Platform Android Platform Web Marketing Product show hidden Search features or add new iOS Platform Android Platform Web Marketing Product show hidden Before update After update

Slide 35

Slide 35

Let’s do some demos Preventing breaking changes Base components Canvas organization

Slide 36

Slide 36

Setup page with components examples Great way to not just see all components in one place, but also seeing how they affect each other.

Bonus: It’s prepared for possible automated visual regression testing in the future (e.g. via Figma REST API). Source: Github Primer Web UI kit

Slide 37

Slide 37

Slide 38

Slide 38

How might we create UI kits that… …designers will love using? …won’t break with future changes? …will be aligned with code?

Slide 39

Slide 39

Design Tokens UI Kit Reference Site Component Library (Documentation) Source & assets: SuperFriendly

Slide 40

Slide 40

Design tokens

Slide 41

Slide 41

What are design tokens? As styles in Figma Design tokens store visual design properties. They help to make UI more consistent across different components and platforms. They are usually tied to themes. Aa Design decision (e.g. color, font size, …) Token data (e.g. json, yaml, …) As variables in React

Slide 42

Slide 42

Tips and trick for aligning design tokens in Figma and in code

Slide 43

Slide 43

Always add name of the token to Figma style name It will help developers to quickly get a name of the code variable directly from the Figma Inspect panel.

If you need to support more formats of code variables, pick the one that has the most developers in the company.

Note: Adding code variable name won’t work, because descriptions are not visible in Figma Inspect panel. Other examples

Slide 44

Slide 44

Leverage tooling to keep design tokens in sync automatically Figma tokens Supernova Design Tokens Specify Knapsack Arcade …

Slide 45

Slide 45

What about components?

Slide 46

Slide 46

Align component API across different implementations It won’t be perfectly aligned because of tooling gap and imperfections, but there is no need to have “type” in React and “variant” in Figma.

Make the connection clear whenever possible.

Slide 47

Slide 47

Source: https://twitter.com/chrisd008/status/1422282553545957384 Source: https://twitter.com/joeyabanks/status/1443981959533891586

Slide 48

Slide 48

https://medium.com/eightshapes-llc/crafting-ui-component-api-together-81946d140371

Slide 49

Slide 49

What’s our process for bringing component API in Figma closer to our code?

Slide 50

Slide 50

Designers collaborate on component API with developers Product Developer Sr. UX Engineer Design Systems Designer Product Designer UX Engineer Engineering Manager

Slide 51

Slide 51

Step 1 Step 2 Design in Figma Step 3 Redlines in Figma Design Systems Designer Product Designer Product Designer Specs in Notion

Slide 52

Slide 52

Step 1 Step 2 Design in Figma Step 3 Specs in Notion Redlines in Figma Sr. UX Engineer Design Systems Designer UX Engineer Engineering Manager

Slide 53

Slide 53

Step 1 Step 2 Design in Figma Step 3 Specs in Notion Redlines in Figma Design Systems Designer UX Engineer Sr. UX Engineer Product Developer Engineering Manager

Slide 54

Slide 54

Step 1 Step 2 Design in Figma Step 3 Redlines in Figma Step 4 Adjust Figma variant properties to match agreed component API. Design Systems Designer Specs in Notion

Slide 55

Slide 55

API consistency is great, but… When not to align API in Figma with code? When it would make a component less usable for designer When it causes large amount of variant permutations (e.g. boolean/toggle properties When it’s not effectively doable in Figma (e.g. nesting content like in HTML)

Slide 56

Slide 56

Key takeaways Provide great UI kit experience by preventing breaking changes Optimize UI kit for usability rather than for maintainability Co-design component API together with developers

Slide 57

Slide 57

Thank you title xxl icon title xxl logo Jan Toman Design System Lead Productboard @HonzaTmn