Styles and components
Keep every colour, size and control in one place. Design tokens hold the values, a component library holds the controls, and a catalogue shows every state.
- Recommended 7
Recommended
Take every style value from design tokens
APP-1Take every colour, space, font size, radius, shadow, duration and layer order from a named design token. Never write a raw value in a component.
Name tokens by purpose
APP-2Give components tokens named by purpose, such as
color-dangerorspace-section, which point to a base palette. Components never use the base palette directly.Build each control once
APP-3Build each control once in a shared component library, and use it on every screen. Never style a raw button, input, select or table on a page.
Change components through variants
APP-4Change how a component looks only through its own options, such as
variant="danger"orsize="small". Never override its classes from the outside.Show every component state in a catalogue
APP-5Give every shared component a catalogue entry for each state it can show, such as default, loading, empty, error and disabled.
Give the component library an owner and version numbers
APP-61Name one owner team for the shared component library. Version it with Semantic Versioning, and add a changelog entry for every change an app can notice.
Retire components with a warning and a removal date
APP-62Mark each component you plan to remove as deprecated, with its replacement and a removal date. A lint rule flags every use, and the build fails once the date has passed while uses remain.
Read this with
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/app-ui/styles-and-components">Agent Wranglers web app interface playbook</a>. In code you write, add a comment next to it with the same link.