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 happenActionAct
Giving the product a value it keepsInputEnter and choose
Reading a state, a label or a personDisplayShow

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…UseNot this
Do the main thing on the screenButton primary, one per viewA second primary; two primaries means neither is
Do a secondary thing next to itButton secondaryghost for a visible alternative, it's too quiet
Act in a toolbar, row or cardButton ghost, often square with an iconsecondary repeated on every row
Delete or remove somethingButton destructive (ghost-destructive / link-destructive in rows)Coral on anything else
Go to another pageA link (<a>, or Button link with asChild)A button that navigates
Pick from several actionsDropdown menu from a ⋯ icon buttonA row of four or more buttons
Understand an icon-only buttonTooltip with the aria-label's wordsNeeded information only in a tooltip

Values live in fields, actions never do

People need to…UseNot this
Type one lineInput in a FieldA bare input with only a placeholder
Type several linesTextarea in a FieldInput
Type with an icon, prefix, unit or button insideInputGroupIcons positioned over an Input
SearchInputGroup with a search icon, type="search"A Select
Pick one of 2–5 options, all visibleRadio groupA Select hiding three options
Pick one of about 5–15 known optionsSelectDropdown menu (that's for actions)
Pick one of many, or by typingCombobox (coming)A Select with 100 rows
Agree to something, or pick severalCheckboxSwitch
Turn a setting on now, no SaveSwitchCheckbox

Show states with words, not just color

People need to…UseNot this
See a status or categoryBadge: success, warning, destructive, info; brand, neutralColored text alone, or a clickable badge
See who a person isAvatar with a nameAvatar for an agent (agents use the mascot)
Group contentA card: rounded-xl bg-card p-4 (Card component coming)A border around every block
Separate groupsSeparator, or FieldSeparator in formsExtra 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.