IconButton
A round button that shows only an icon; its label is for assistive technology.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
icon | string | The icon to show. | |
label | string | The accessible name, such as Search. | |
variant | "primary" | "secondary" | "ghost" | "danger" | ghost | Its look. |
size | "sm" | "md" | "lg" | md | 32, 44 or 56 pixels square. |
disabled | boolean | false | Cannot be pressed or focused. |
selected | boolean | For a button that stays on, such as Like: tinted primary and announced as pressed. | |
onPress | () => void | Runs when pressed. |
States
| State | Looks like |
|---|---|
pressed | Scales to 92%. |
focused | A 2px primary outline. |
disabled | 45% opacity. |
selected | The icon turns primary; aria-pressed is true. |
Accessibility
| role | button |
| name | The label prop. |
| focus | Tab reaches it; Shift+Tab leaves it. A disabled one is skipped. |
| keyboard | Enter and Space press it. |
| notes | With selected it is a toggle button (aria-pressed true or false). |
Theme tokens
color.primary color.on-primary color.raised color.border color.ink color.danger radius.full
Example
<IconButton icon="heart" label="Like" selected={liked} onPress={toggleLike} />