Button
Four variants in three sizes. The main action of a view is the only filled green button; everything else steps back.
Variants
The fill says how much a button asks for. Brass is never an action; the main action is the green (ivory in dark).
Sizes
One height for buttons and fields, so a row of both lines up.
States
Every variant in every state. Hover and focus are forced on here with a class; in the product they follow the pointer and the keyboard.
| Variant | Default | Hover | Focus | Disabled | Loading |
|---|---|---|---|---|---|
| Primary | |||||
| Secondary | |||||
| Ghost | |||||
| Danger |
Pressed moves the button down by one pixel. A loading button keeps its width, shows a spinner in place of its label and sets aria-busy; it ignores a second click.
With an icon
A 16 px icon, drawn in the label’s color. An icon-only button is a square of the same height.
Live and full width
Properties
| Property | Values | Default | Use |
|---|---|---|---|
variant | primary secondary ghost danger | primary | One primary per view; danger only where the action cannot be undone. |
size | sm md lg | md | Heights 32, 40 and 48 px; the large one on a phone and at checkout. |
icon | start end only | — | The icon-only button needs an aria-label. |
loading | true false | false | Shows the spinner, sets aria-busy and ignores clicks; the width does not change. |
disabled | true false | false | Half-strength, no pointer events. Say why next to it when the reason is not obvious. |
fullWidth | true false | false | Fills its container; used in forms on a phone. |
type | button submit | button | A button inside a form that submits it is type submit; a link that looks like a button is an anchor. |