UX9: Design systems and handover

Lesson 2 of 5 ยท reading 15โ€“25 minutes; practice and project time is on the module page

Components and their states

๐ŸŽฏYou'll be able to

Define a small set of components, each with its variants and states, built from tokens.

๐Ÿ The everyday picture

A modular kitchen is built from a few standard units: base cabinets, wall cabinets, drawers. Each comes in a few sizes and finishes. Any kitchen can be made from them, and every unit fits.

๐Ÿ“˜What it really is

๐Ÿ“A worked example

Input: the reference time slot component.

Part Decision
Element <button type="button" class="slot" aria-pressed="false">
Size at least 48 pixels high, full grid cell wide
Default primary-coloured text and border on the surface colour
Selected filled with primary, white text, a tick before the time, aria-pressed="true"
Focus 3 px outline in --color-focus
Disabled (booked) disabled colours, disabled attribute, hidden word "booked"

Expected output: the component page shows all four states, and test 6 of npm run test:system finds each one.

๐ŸŒWhere it's used

๐Ÿ“Case scenario

A retail company had 37 different button styles across its apps. An audit grouped them into two variants and five states. Building screens got faster, and accessibility fixes made once in the button reached every app.

๐Ÿ–ฑ๏ธTry it

List the components you'd need for SehatSlot's "My appointments" screen (which the kit doesn't have yet). Success: you reuse at least three existing components and propose at most one new one, with its states.

โš ๏ธCommon mistakes

๐Ÿ› ๏ธFor your project

Project 3's component page must show button, text field, time slot and alert in every required state.

โœ…Quick check

What is the difference between a variant and a state?

Show the answer

A variant is a deliberate version (primary or secondary); a state is a condition it can be in (focus, disabled, loading).

Why build accessibility into components?

Show the answer

So every team that uses them gets it automatically.

โ† PreviousDesign tokens
ProLearners Assist