Component docs

Button

Triggers an action. One primary button per view; everything else steps down.

When to use

  • Use for actions that change data or open UI. Use a link for navigation.
  • Keep labels short verbs: “Save changes”, not “Click here”.
  • Use `loading` instead of disabling during async work so focus stays put.

Playground

Change props on the right; the preview and code update instantly.

Props
<Button variant="primary" size="md">Save changes</Button>

Props

PropTypeDefaultDescription
variantprimary | secondary | outline | ghost | destructiveprimaryVisual emphasis.
sizesm | md | lgmdScale. `sm` keeps a 44px hit area.
loadingbooleanfalseShows a spinner, sets aria-busy and announces loadingLabel.
loadingLabelstringLoading, please waitText announced to screen readers while loading.
fullWidthbooleanfalseStretches to the container width.
startIconReactNode—Icon before the label (decorative).
endIconReactNode—Icon after the label (decorative).
disabledbooleanfalseNative disabled state; removes from tab order.

Keyboard navigation

KeysBehavior
Tab / Shift+TabMove focus to / from the button.
EnterActivate.
SpaceActivate (on key release).

ARIA attributes

AttributeGuidance
aria-labelRequired on icon-only buttons. Describe the action, not the icon.
aria-busySet automatically while `loading`; the polite live region announces loadingLabel.
aria-pressedAdd only for toggle buttons, with true/false reflecting state.
aria-expanded / aria-controlsAdd when the button opens a menu or disclosure.

Theme tokens

Every part of Button reads from these tokens, so it re-themes in light and dark automatically.

PartTokens
Container (primary)
--primary--primary-hover--primary-active--shadow-xs
Container (secondary)
--secondary--secondary-hover--secondary-active
Container (outline / ghost)
--border-strong--muted--primary-subtle
Container (destructive)
--destructive--destructive-hover
Label
--primary-foreground--secondary-foreground--font-body--weight-semibold--text-sm--text-body--text-lg
Shape & spacing
--radius-md--space-2--space-3--space-5--border-width
Focus ring
--focus-ring--focus-ring-width--focus-ring-offset
Hit area & motion
--target-min--duration-fast--ease-standard--opacity-disabled

Accessibility checklist

0 of 7 verified

Focus
Contrast
Target size
Keyboard
Screen reader

Check contrast numbers live on the Accessibility page.