Button
The main pressable control: a label, an optional icon, in four variants and three sizes.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
label | string | The text on the button, and its accessible name. | |
variant | "primary" | "secondary" | "ghost" | "danger" | primary | How much the button stands out; danger for destructive actions. |
size | "sm" | "md" | "lg" | md | Height 32, 44 or 52 pixels. |
icon | string | An icon from the built-in set, before the label. | |
iconEnd | string | An icon after the label, such as arrow-right. | |
loading | boolean | false | Shows a spinner in place of the icon and stops presses. |
disabled | boolean | false | Cannot be pressed or focused; drawn at 45% opacity. |
full | boolean | false | Takes the full width of its container. |
submit | boolean | false | Pressing it sends the form it is in. |
onPress | () => void | Runs when the button is pressed. |
Children
Extra content after the label.
States
| State | Looks like |
|---|---|
pressed | Scales to 97% and darkens its background. |
focused | A 2px primary outline, 2px away. |
disabled | 45% opacity; no presses, no focus. |
loading | A small spinner replaces the icon; disabled while it shows. |
Accessibility
| role | button |
| name | The label text (or the children). |
| focus | Tab reaches it; Shift+Tab leaves it. A disabled one is skipped. |
| keyboard | Enter and Space press it. |
Theme tokens
color.primary color.on-primary color.raised color.border color.ink color.danger space.3 space.4 space.6 radius.md radius.sm text.label text.caption
Example
<Button label="Save" icon="check" loading={saving} onPress={save} />