Skip to content

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

Updated 2026-11-12

Playground

Change the props and the surface. The controls come from the documented props; the surfaces are the real modes.
tsx
<Button>Request a project</Button>

States

Every variant in every state, side by side. Hover, pressed and focus are shown statically; the default state is interactive.

primary

  • default
  • hover
  • active
  • focus-visible
  • disabled
  • loading

accent

  • default
  • hover
  • active
  • focus-visible
  • disabled
  • loading

secondary

  • default
  • hover
  • active
  • focus-visible
  • disabled
  • loading

ghost

  • default
  • hover
  • active
  • focus-visible
  • disabled
  • loading

danger

  • default
  • hover
  • active
  • focus-visible
  • disabled
  • loading

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.
Do
  • At most one primary button per area.
  • Write the label as a concrete verb.
Don’t
  • 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

The parts of the component and what each one does, as in the playground above.
  1. containerPill-shaped surface (radius.full) that carries variant and state.
  2. labelOnest semibold, one line, never wraps.
  3. iconOptional, before or after the label; decorative unless the button has no text.

Examples

Type-checked, and the same code goes into the AI manifest. Import: import { Button } from "@/ds";

Primary

Accent

Secondary

Ghost

Danger

Loading

Size sm

Props

Checked against the component's TypeScript type on every build.
Button props
NameTypeDefaultDescription
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.
hrefstring–Renders a link instead of a <button>.
asChildbooleanfalsePasses the button classes to its only child element.
disabledbooleanfalseDisables the action.
loadingbooleanfalseSpinner, aria-busy, clicks ignored; the label stays so the width doesn't jump.
children (required)ReactNode–Label, written as a verb.

Tokens used

Derived from the utility classes in the component's source. Copy a class with one click.
Tokens used by Button
TokenTierValueUtility
button.accent.bgcomponent#C6492E
button.accent.bgHovercomponent#A33B23
button.accent.bgPressedcomponent#86301B
button.accent.fgcomponent#FFFFFF
button.danger.bgcomponent#B4342A
button.danger.bgHovercomponent#942A20
button.danger.bgPressedcomponent#942A20
button.danger.fgcomponent#FFFFFF
button.ghost.fgcomponent#0A0A0B
button.ghost.fgHovercomponent#C6492E
button.ghost.fgPressedcomponent#86301B
button.primary.bgcomponent#0A0A0B
button.primary.bgHovercomponent#2E2E2E
button.primary.bgPressedcomponent#2E2E2E
button.primary.fgcomponent#FAFAF7
button.radiuscomponent9999px
button.secondary.bordercomponent#8A8578
button.secondary.borderHovercomponent#0A0A0B
button.secondary.borderPressedcomponent#86301B
button.secondary.fgcomponent#0A0A0B
button.secondary.fgPressedcomponent#86301B
button.size.md.fontSizecomponent15px
button.size.md.heightcomponent48px
button.size.md.paddingXcomponent24px
button.size.sm.fontSizecomponent13px
button.size.sm.heightcomponent32px
button.size.sm.paddingXcomponent12px
button.weightcomponent600
focussemantic#C6492E
spacing.2semantic8px
spacing.4semantic16px
state.disabledsemantic0.5
surface.pagesemantic#FAFAF7

Accessibility

What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
Testing status by check
CheckHowStatus
axe-core rulesAutomated on every npm run check, at desktop and mobile widthRuns on every build
KeyboardAutomated Playwright test (scripts/keyboard.mjs)Tested
Screen readerManualNot tested yet

Keyboard

Button keyboard interactions
KeyAction
TabMoves focus to the button.
EnterActivates the button or follows the link.
SpaceActivates 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

Button contrast pairings
PairingRatio (x:1)MinimumStatus
text.primary on surface.page18.924.5Pass
accent.default on surface.page4.574.5Pass
text.onInverse on surface.inverse18.924.5Pass
text.onInverse on surface.inverseHover12.994.5Pass
text.onAccent on accent.default4.784.5Pass
text.onAccent on accent.hover6.554.5Pass
text.onAccent on accent.pressed8.564.5Pass
accent.pressed on surface.page8.194.5Pass
border.control on surface.page3.523.0Pass
focus on surface.page4.573.0Pass
status.danger.fg on surface.page5.804.5Pass
text.onAccent on status.danger.fg6.064.5Pass
text.onAccent on status.danger.hover8.044.5Pass
surface.inverse on text.onInverse18.924.5Pass
border.control on surface.inverse5.383.0Pass
accent.default on surface.inverse4.143.0Pass
surface.inverse on accent.default4.143.0Pass