# Actions (/guides/actions) This guide decides which variant an action gets, where it goes, and when it turns coral. It applies to every button, link and menu row. The component itself is on [Button](/library/components/button). ## Ask one question: does this destroy something? [#ask-one-question-does-this-destroy-something] | Answer | Variant | Why | | ------------------------------------------------ | ------------------------------------------------------------------ | ----------------------------------- | | Yes, and it's the main action (a confirm dialog) | `destructive` | The one place a coral fill is right | | Yes, in a row, card or menu | `ghost-destructive`, `link-destructive`, or a destructive menu row | Coral, but quiet until it's needed | | No, it's what people came to do | `primary` | The next step | | No, it's an alternative to that | `secondary` | Visible, but steps back | | No, it's in a toolbar, row or card | `ghost` | Present without competing | | No, it sits in a sentence or goes somewhere | `link` | Reads as part of the text | ## One primary per view [#one-primary-per-view] Each view has at most one `primary` button. If two actions compete, neither is primary: make one `secondary`, or ask which one most people came for. ```tsx
``` ## The primary goes last [#the-primary-goes-last] In dialogs, forms and footers the primary action sits on the right, alternatives to its left, 8px apart (`gap-2`). People read to the end and find the next step there. ## Labels say what happens [#labels-say-what-happens] Verb + noun, in sentence case: "Connect provider", "Rename agent". Name the result: "Create agent" tells people what they'll get; "Continue" doesn't. Not "Submit", "OK" or "Click here"; no all caps, no full stop. ## Sizes match the fields beside them [#sizes-match-the-fields-beside-them] `sm` 32px, `md` 36px (default), `lg` 40px. `lg` is the largest, also on mobile, where touch targets are at least 40px. `xs` (28px) is for dense chrome like toolbars. Inputs and selects share these sizes, so a button sits level with the field next to it. ## Icon buttons always say what they do [#icon-buttons-always-say-what-they-do] ```tsx Copy link ``` An icon-only button has an `aria-label` and a tooltip with the same words. Icons go straight inside Button; it sizes them. ## Three actions show, more go in a menu [#three-actions-show-more-go-in-a-menu] * Up to three related actions: buttons. * More than three, or actions on each row or card: a `ghost` `square` ⋯ button opening a [Dropdown menu](/library/components/dropdown-menu) with `align="end"`. * Menu rows are verb + noun, most used first, destructive rows last after a separator. ## Permanent deletes are confirmed by name [#permanent-deletes-are-confirmed-by-name] | Situation | Do | | ----------------------------------- | -------------------------------------------------------------------------------------------------------------- | | Delete one thing, easy to undo | Delete right away, then offer undo | | Delete something permanent or large | A dialog that names it: "Delete *Research agent*?", the consequence, and a `destructive` "Delete agent" button | | Remove inline, e.g. disconnect | `link-destructive` | Focus Cancel when a confirm dialog opens, never the destructive button. ## Loading beats disabled [#loading-beats-disabled] ` ``` Field puts the label 2px above the control and help or error text 8px below. FieldGroup spaces fields 16px apart, FieldSet sections 24px apart. Don't add your own margins. ## The control follows the number of options [#the-control-follows-the-number-of-options] | People… | Use | | ---------------------------- | ------------------------------------------------------------------------ | | Type one line | `Input` with the right `type`: `email`, `url`, `tel`, `number`, `search` | | Type several lines | `Textarea` | | Pick one of 2–5, all visible | `RadioGroup` | | Pick one of about 5–15 | `Select` | | Agree, or pick several | `Checkbox` | Checkboxes and switches sit beside their label: `` with a `FieldContent` for the label and help text. ## Labels stay visible; placeholders are examples [#labels-stay-visible-placeholders-are-examples] Every control has a visible label in sentence case, linked with `htmlFor` and `id` . Help text says what people need before they type: the format, or why it's asked. If most fields are required, mark the optional ones ("Note (optional)"). If most are optional, mark the required ones with `` . Don't use the placeholder as the label; it disappears as people type. ## Validate when people leave a field, not while they type [#validate-when-people-leave-a-field-not-while-they-type] 1. Check a field when it loses focus, and all fields on submit. Never on every keystroke. 2. On submit, move focus to the first field with an error. 3. Keep the error until the value is fixed, then remove it right away. ## Errors name the fix [#errors-name-the-fix] Write the message as what to do: "Enter a full email address, like [name@example.com](mailto:name@example.com)", not "Invalid input". One error per field, below it, in coral with a coral border. Never color alone: the message is always there. ## Disabled, read-only and saving [#disabled-read-only-and-saving] * **Disabled:** set `disabled` on the control; Field softens its label and help. Say why nearby if it isn't obvious. * **Read-only:** `readOnly` on Input keeps the value focusable and copyable. * **Saving:** ` Wrap the avatar in a real `button` with an `aria-label`. The gold focus ring comes from the theme; tab to the example to see it. ## Group [#group] +4 {[['Sam Rivera', '/examples/person-3.png'], ['Lea Fischer'], ['Omar Haddad', '/examples/person-2.png']].map(([name, src]) => ( {src && } ))} +2 Every avatar in a group shares one size; give `AvatarGroupCount` the same `size`. Each avatar gets a ring in the page color so the overlap reads clearly. ## Loading [#loading] {['xs', 'sm', 'md', 'lg'].map((size) => ( ))} ## Behavior [#behavior] #### The fallback is a cascade [#the-fallback-is-a-cascade] The image loads over the fallback. While it loads, or if the address is broken, people see initials, never an empty circle that later jumps. #### Initials stop at two [#initials-stop-at-two] First word plus last word: "Mary Jane Watson" is **MW**. Emoji and accented letters are never cut in half. Use `getInitials(name)` if you need the same letters elsewhere. #### The name is the label [#the-name-is-the-label] With `name`, screen readers announce "Maya Lindqvist", not "O R". Without a name (the icon fallback), add `role="img"` and an `aria-label`. ## API reference [#api-reference] `AvatarImage` takes the usual `src` and `alt` (keep `alt=""` when `name` is set). `AvatarFallback` shows its children if you pass them, otherwise the initials, otherwise the icon. `AvatarBadge` and `AvatarGroupCount` take `className`; `AvatarGroupCount` and `AvatarSkeleton` also take `size`. ## Guidelines [#guidelines] Always pass a `name` . Different initials make a list read as different people instead of a wall of identical icons. Use avatars for people only. Agents are shown with the mascot. Use `xs` (20px) in menus and dense lists, `md` or `lg` in rows, cards and chat. For several people, use a group with a few avatars and a +N chip, never one avatar and a number. Don't rely on the indicator color alone; say what it means in text nearby. Don't make avatars square or give them other colors; one consistent circle keeps people recognisable everywhere. ## Related [#related] 12 · 14 · 16 · 20 # Badge (/library/components/badge) ## Usage [#usage] ```bash pnpm dlx shadcn@latest add badge ``` Then replace `components/ui/badge.tsx` with the [Matrix version](https://github.com/FinnaAI/matrix-os-design-library/blob/main/components/ui/badge.tsx). It keeps shadcn's API and adds the status variants, sizes and the dot. ```tsx import { Badge, BadgeDot } from '@/components/ui/badge'; Connected Needs review ``` ## Variants [#variants] Connected Needs review Failed Syncing Paused Built-in Plugin Each variant is one of the [tint sets](/library/foundations/colors#tints): a light fill, a matching edge and dark text, all above 6:1. Status colors carry meaning (teal success, gold warning, coral failure, blue information); `brand` and `neutral` label a category. ## Sizes [#sizes] Small sm · 12px text Medium md · 13px text Large lg · 14px text `md` is the default. Match the badge to the text beside it: `sm` next to 12px metadata, `md` in lists and tables, `lg` next to 14px body text. ## With dot [#with-dot] Online Away Offline The dot takes the variant's solid status color, so it reads as live state. Use it for things that change on their own: presence, a running agent, a connection. ## With icon [#with-icon] Verified Attention New Icons are sized by the badge (12px, or 14px in `lg`) and take its text color. An icon plus a word works for everyone; color alone doesn't. ## API reference [#api-reference] shadcn's `default`, `secondary` and `outline` are accepted too and render the neutral badge. `BadgeDot` takes no props of its own; its color follows the badge's variant. ## Guidelines [#guidelines] Write labels in sentence case, one or two words: "Needs review", not "Needs Review". Keep labels short, under about 20 characters; a badge never wraps. Pick the variant by meaning: success, warning, destructive and info for state; brand and neutral for category. Pair color with a word or an icon, never color alone. Don't use badges as buttons or links. For something people click or remove, use a tag. Don't color a badge by hand with `className` ; if no variant fits, the meaning probably needs a word instead. ## Related [#related] # Button (/library/components/button) ## Usage [#usage] ```bash pnpm dlx shadcn@latest add button ``` Then replace `components/ui/button.tsx` with the [Matrix version](https://github.com/FinnaAI/matrix-os-design-library/blob/main/components/ui/button.tsx). It keeps shadcn's API and adds the Matrix variants, sizes, `square`, `round` and `loading`. ```tsx import { Button } from '@/components/ui/button'; ``` ## Variants [#variants] Primary is the dark neutral; secondary is outlined on the page color; ghost has no fill until hover. Links are always underlined. The neutral link turns dark brand green on hover, like primary; the coral link just gets a shade darker (coral-600 → coral-700). ## Destructive [#destructive] Coral means danger, so it's only for deleting, removing or disconnecting. Use the solid version for the final confirm, and the ghost or link version where the action is one of several. ## Sizes [#sizes] {['xs', 'sm', 'md', 'lg'].map((size) => ( {size} · {({ xs: '28px, 13px', sm: '32px, 14px', md: '36px, 14px', lg: '40px, 17px' })[size]} ))} `md` (36px) is the default. Every size has an 8px corner, so buttons read as one family next to each other. ## With icon [#with-icon] Put a Lucide icon straight inside the button; it's sized for you (14px at `xs`, 16px above) and the padding on that side tightens so the button stays balanced. ## Icon only [#icon-only] `square` makes the width equal the height at any size. Use `ghost` for quiet neutral icon actions (more, edit, close) and `ghost-destructive` only when the action deletes or removes; add `round` for circular buttons like the chat composer's send. An icon-only button always needs an `aria-label`. ## States [#states] `loading` shows a spinner, keeps the button's width and blocks clicks. Hover and focus are built in: tab to any button on this page to see the gold focus ring. ## API reference [#api-reference] ## Guidelines [#guidelines] One primary button per view. If two actions compete, neither is primary. Write labels as verb + noun in sentence case: "Create agent", "Connect provider", not "Submit" or "OK". Use `xs` in dense chrome like toolbars, `md` in content and forms, `lg` for a single focused action such as onboarding. Keep coral for actions that destroy or remove something. Don't disable a button without saying why; add helper text, or a [tooltip on a wrapper](/library/components/tooltip#variants) (a disabled button can't show one itself). Don't use ghost or link for the main action; they don't carry enough weight. ## Related [#related] Connected 14 · 16 # Checkbox (/library/components/checkbox) ## Usage [#usage] ```bash pnpm dlx shadcn@latest add checkbox ``` Then replace `components/ui/checkbox.tsx` with the [Matrix version](https://github.com/FinnaAI/matrix-os-design-library/blob/main/components/ui/checkbox.tsx). It keeps shadcn's API (`checked`, `onCheckedChange`, `defaultChecked`) and adds the Matrix sizes and look. ```tsx import { Checkbox } from '@/components/ui/checkbox'; import { Field, FieldLabel } from '@/components/ui/field'; I agree to the terms ``` ## Variants [#variants] ## States [#states]
Focus
Disabled · on
Disabled · off
Invalid
## Sizes [#sizes]
sm · 16px (default)
md · 20px
`sm` sits next to 14px text in forms, lists and tables. `md` is for touch and for checkboxes that are the main control on a screen. ## With a label [#with-a-label] Weekly summary A short email with what your agents did this week.
Notify me about Finished tasks Tasks waiting for approval Failed runs
Clicking the label toggles the checkbox, so the whole row is a target. ## Behavior [#behavior] #### Space toggles; Enter doesn't [#space-toggles-enter-doesnt] Space checks and unchecks, the same as a native checkbox. Enter is left for submitting the form around it. #### Indeterminate is set from code [#indeterminate-is-set-from-code] Use `checked="indeterminate"` for a "select all" box when only some items in the group are selected. Clicking it selects all. ## API reference [#api-reference] ## Guidelines [#guidelines] Use a checkbox for choices saved with a form, consent ("I agree to the terms") and multi-select lists. Write labels as a positive statement of what checking does: "Send a weekly summary", not "Don't send emails". Link the label with `htmlFor` so clicking the text toggles the box. Don't use a checkbox for a setting that takes effect immediately; use a [Switch](/library/components/switch) . Don't use checkboxes when only one option can be picked; use a [Radio group](/library/components/radio-group) . ## Related [#related] Email # Dropdown menu (/library/components/dropdown-menu) ## Usage [#usage] ```bash pnpm dlx shadcn@latest add dropdown-menu ``` Then replace `components/ui/dropdown-menu.tsx` and add `menu-styles.ts` from the [Matrix versions](https://github.com/FinnaAI/matrix-os-design-library/tree/main/components/ui). The menu card, rows, labels and dividers come from `menu-styles.ts`, which Select shares, so a menu and a select's options always look the same. Menus animate with `tw-animate-css`, shadcn's standard. ```tsx import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; Rename Duplicate Delete ``` A menu is for actions. To pick a value in a form, use a [Select](/library/components/select). ## At a glance [#at-a-glance] Agent Rename Duplicate Share Sort by Last active Name Delete agent Rows highlight in neutral on hover or with the arrow keys. The selected option shows a check at the end of the row. Delete is the only coral row. ## Variants [#variants] Rename Duplicate Delete [alex@example.com](mailto:alex@example.com) Profile Settings Log out Rename ⌘E Duplicate ⌘D Delete ⌘⌫ Sort by Last active Name Date created Rename Share Copy link Invite people ## Behavior [#behavior] #### The keyboard is built in [#the-keyboard-is-built-in] Enter, Space or ArrowDown opens the menu; arrows move, typing jumps to a matching row, Escape closes and returns focus to the trigger. #### Highlight, not a focus ring [#highlight-not-a-focus-ring] Rows highlight in neutral on hover and with the arrow keys. The gold ring stays on the trigger, so a menu never fills with rings. #### Rows don't wrap [#rows-dont-wrap] Labels stay on one line. Keep them short (verb + noun); the menu grows to fit, up to the screen edge. #### Touch grows the rows [#touch-grows-the-rows] On a touch screen rows grow from 32px to 40px, automatically. ## API reference [#api-reference] ## Guidelines [#guidelines] Open menus from a button: an icon button (⋯) for row or card actions, a labelled button for a toolbar. Write rows as verb + noun ("Rename agent"); order them by how often they're used, with destructive actions last, after a divider. Use a divider only before destructive rows or between labelled groups. Ordinary actions like Archive or Share don't get their own divider. Give every row an icon or none; don't mix within a group. Don't use a menu to pick a value in a form; use a [Select](/library/components/select) . Don't nest more than one submenu deep. ## Related [#related] Daily ⌄ # Field (/library/components/field) ## Usage [#usage] ```bash pnpm dlx shadcn@latest add field ``` Then replace `components/ui/field.tsx`, `label.tsx` and `separator.tsx` with the [Matrix versions](https://github.com/FinnaAI/matrix-os-design-library/tree/main/components/ui). They keep shadcn's parts and add the Matrix type, colors and spacing. ```tsx import { Field, FieldDescription, FieldLabel } from '@/components/ui/field'; import { Input } from '@/components/ui/input'; Email We'll send the invite here. ``` The spacing is part of the component: the **label sits 2px above** its control, **help text and errors 8px below** it, **16px between fields** and **24px between sections**. Validation timing and error copy follow the [Input behavior](/library/components/input#behavior). ## Field [#field] Email We'll send the invite here. ## Group [#group] Name Handle Purpose ## Grid [#grid] First name Last name Use a grid only for short, related pairs (first and last name, city and postcode). It stacks on narrow screens. ## Required [#required] Email `required` on the label adds the asterisk; set `required` on the control too, so browsers and screen readers know. The asterisk is neutral, not coral: coral means an error. ## Error [#error] Email Enter a full email address, like [name@example.com](mailto:name@example.com) . Set `aria-invalid` on the control (coral border) and put the message in `FieldError`, linked with `aria-describedby`. The label stays neutral. `FieldError` also accepts an `errors` array from form libraries and shows each message once. ## Disabled [#disabled] Workspace Only owners can rename the workspace. Disable the control and the field softens its own label and help text. Use the help text to say why it's disabled. ## Inline [#inline] The default sizes already line up (Input `md` and Button `md` are both 36px), with 8px between them. ## Complete form [#complete-form]
Invite a teammate First name Last name Email They'll get an email with a link to join. Note (optional)