Choosing a component
Start from what people need to do, then pick the component. One component per job, so the same task looks and works the same everywhere in Matrix OS.
This guide decides which component does a job. It applies whenever you, or an agent, are about to reach for a component, before writing any code.
Ask one question: does it act, hold a value, or show?
| People are… | It's a… | Start in |
|---|---|---|
| Making something happen | Action | Act |
| Giving the product a value it keeps | Input | Enter and choose |
| Reading a state, a label or a person | Display | Show |
Most mistakes come from crossing these: a menu that holds a value, a switch inside a form, a badge you can click.
Act: buttons run things, menus group them
| People need to… | Use | Not this |
|---|---|---|
| Do the main thing on the screen | Button primary, one per view | A second primary; two primaries means neither is |
| Do a secondary thing next to it | Button secondary | ghost for a visible alternative, it's too quiet |
| Act in a toolbar, row or card | Button ghost, often square with an icon | secondary repeated on every row |
| Delete or remove something | Button destructive (ghost-destructive / link-destructive in rows) | Coral on anything else |
| Go to another page | A link (<a>, or Button link with asChild) | A button that navigates |
| Pick from several actions | Dropdown menu from a ⋯ icon button | A row of four or more buttons |
| Understand an icon-only button | Tooltip with the aria-label's words | Needed information only in a tooltip |
Values live in fields, actions never do
| People need to… | Use | Not this |
|---|---|---|
| Type one line | Input in a Field | A bare input with only a placeholder |
| Type several lines | Textarea in a Field | Input |
| Type with an icon, prefix, unit or button inside | InputGroup | Icons positioned over an Input |
| Search | InputGroup with a search icon, type="search" | A Select |
| Pick one of 2–5 options, all visible | Radio group | A Select hiding three options |
| Pick one of about 5–15 known options | Select | Dropdown menu (that's for actions) |
| Pick one of many, or by typing | Combobox (coming) | A Select with 100 rows |
| Agree to something, or pick several | Checkbox | Switch |
| Turn a setting on now, no Save | Switch | Checkbox |
Show states with words, not just color
| People need to… | Use | Not this |
|---|---|---|
| See a status or category | Badge: success, warning, destructive, info; brand, neutral | Colored text alone, or a clickable badge |
| See who a person is | Avatar with a name | Avatar for an agent (agents use the mascot) |
| Group content | A card: rounded-xl bg-card p-4 (Card component coming) | A border around every block |
| Separate groups | Separator, or FieldSeparator in forms | Extra margin plus a line |
Missing components borrow from shadcn, restyled
Dialog, Popover, Tabs, Table, Toast, Combobox and Card aren't in the library yet. Until they are, use the shadcn version restyled with Matrix tokens (overlays rounded-lg bg-popover shadow-lg, dialogs shadow-xl) and note it in the pull request.
Accessibility comes with the right choice
Picking the right component is most of the accessibility work: a Select is announced as a list of options, a Switch as on/off, a Radio group lets arrows move between options. Rebuilding one from divs loses all of that.
Not covered here
How to style what you picked is Color usage; where actions go is Actions; how fields behave together is Forms.