Actions
Button
Triggers an action, or leads to a page when given an href. One primary action per area.
- Ready
- Keyboard tested
- Screen reader not tested yet
Playground
<Button>Request a project</Button>States
primary
accent
secondary
ghost
danger
Usage
When to use
Use a button for an action on the current page:
- submitting or saving a form
- starting a flow
- opening a dialog
When not to use
To go to another page, use a Link. Use a button with href only when the link is the main call to action of an area. For quick filters, use FilterChips.
How it works
primary is the ink surface and the default for the one main action of an area. accent is the terracotta surface for rare emphasis; terracotta stays the one colour moment on a page. secondary has a control border, ghost is text only. danger is red and only for actions that delete or can't be undone. Hover and pressed darken the surface; keyboard focus shows a 2px ring. With loading, the button shows a spinner, stays focusable and can't be triggered again until the action is done.
Content guidelines
Start with a verb and name the result: “Send request”, not “OK” or “Submit”. Keep it to one line; buttons never wrap. A danger button repeats the verb and the object: “Delete project”.
Do and don’t
DoOne primary action, the alternative as secondary. Don’tTwo primary buttons compete for attention. DoA label that says what happens. Don’tA vague label that needs context.
- At most one primary button per area.
- Write the label as a concrete verb.
- No two primary buttons side by side.
- Don't use accent as the default call to action; terracotta stays the one colour moment.
- Don't use a button for plain navigation without href.
- Don't use danger for anything that can be undone; it is for delete, withdraw, remove.
Anatomy
- containerPill-shaped surface (radius.full) that carries variant and state.
- labelOnest semibold, one line, never wraps.
- iconOptional, before or after the label; decorative unless the button has no text.
Examples
Props
| Name | Type | Default | Description |
|---|---|---|---|
| variant | "primary" | "accent" | "secondary" | "ghost" | "danger" | "primary" | primary is the ink surface, accent the terracotta surface for rare emphasis, danger the red surface for destructive actions. |
| size | "sm" | "md" | "md" | md for forms and calls to action, sm for dense areas. |
| href | string | – | Renders a link instead of a <button>. |
| asChild | boolean | false | Passes the button classes to its only child element. |
| disabled | boolean | false | Disables the action. |
| loading | boolean | false | Spinner, aria-busy, clicks ignored; the label stays so the width doesn't jump. |
| children (required) | ReactNode | – | Label, written as a verb. |
Tokens used
| Token | Tier | Value | Utility |
|---|---|---|---|
| button.accent.bg | component | #C6492E | |
| button.accent.bgHover | component | #A33B23 | |
| button.accent.bgPressed | component | #86301B | |
| button.accent.fg | component | #FFFFFF | |
| button.danger.bg | component | #B4342A | |
| button.danger.bgHover | component | #942A20 | |
| button.danger.bgPressed | component | #942A20 | |
| button.danger.fg | component | #FFFFFF | |
| button.ghost.fg | component | #0A0A0B | |
| button.ghost.fgHover | component | #C6492E | |
| button.ghost.fgPressed | component | #86301B | |
| button.primary.bg | component | #0A0A0B | |
| button.primary.bgHover | component | #2E2E2E | |
| button.primary.bgPressed | component | #2E2E2E | |
| button.primary.fg | component | #FAFAF7 | |
| button.radius | component | 9999px | |
| button.secondary.border | component | #8A8578 | |
| button.secondary.borderHover | component | #0A0A0B | |
| button.secondary.borderPressed | component | #86301B | |
| button.secondary.fg | component | #0A0A0B | |
| button.secondary.fgPressed | component | #86301B | |
| button.size.md.fontSize | component | 15px | |
| button.size.md.height | component | 48px | |
| button.size.md.paddingX | component | 24px | |
| button.size.sm.fontSize | component | 13px | |
| button.size.sm.height | component | 32px | |
| button.size.sm.paddingX | component | 12px | |
| button.weight | component | 600 | |
| focus | semantic | #C6492E | |
| spacing.2 | semantic | 8px | |
| spacing.4 | semantic | 16px | |
| state.disabled | semantic | 0.5 | |
| surface.page | semantic | #FAFAF7 |
Accessibility
| Check | How | Status |
|---|---|---|
| axe-core rules | Automated on every npm run check, at desktop and mobile width | Runs on every build |
| Keyboard | Automated Playwright test (scripts/keyboard.mjs) | Tested |
| Screen reader | Manual | Not tested yet |
Keyboard
| Key | Action |
|---|---|
| Tab | Moves focus to the button. |
| Enter | Activates the button or follows the link. |
| Space | Activates the button (not the link variant). |
Semantics and focus
- Renders a native <button type="button"> or <a>; no role override needed.
- Focus is visible as a 2px ring in focus with a 2px offset.
- A disabled link is rendered without href and gets aria-disabled.
- Loading sets aria-busy and adds “(loading)” to the accessible name; the spinner stops with reduced motion.
Contrast
| Pairing | Ratio (x:1) | Minimum | Status |
|---|---|---|---|
| text.primary on surface.page | 18.92 | 4.5 | Pass |
| accent.default on surface.page | 4.57 | 4.5 | Pass |
| text.onInverse on surface.inverse | 18.92 | 4.5 | Pass |
| text.onInverse on surface.inverseHover | 12.99 | 4.5 | Pass |
| text.onAccent on accent.default | 4.78 | 4.5 | Pass |
| text.onAccent on accent.hover | 6.55 | 4.5 | Pass |
| text.onAccent on accent.pressed | 8.56 | 4.5 | Pass |
| accent.pressed on surface.page | 8.19 | 4.5 | Pass |
| border.control on surface.page | 3.52 | 3.0 | Pass |
| focus on surface.page | 4.57 | 3.0 | Pass |
| status.danger.fg on surface.page | 5.80 | 4.5 | Pass |
| text.onAccent on status.danger.fg | 6.06 | 4.5 | Pass |
| text.onAccent on status.danger.hover | 8.04 | 4.5 | Pass |
| surface.inverse on text.onInverse | 18.92 | 4.5 | Pass |
| border.control on surface.inverse | 5.38 | 3.0 | Pass |
| accent.default on surface.inverse | 4.14 | 3.0 | Pass |
| surface.inverse on accent.default | 4.14 | 3.0 | Pass |