IconButton
IconButton is the square, icon-only button. It shares Button's variant matrix and fixes the
aspect ratio to a square — and it requires an aria-label, because the icon alone names nothing.
What it is
A Pressable with the same variant × intent × size matrix as Button, sized to a square and
centring a single icon. The size token sets the box dimensions — an IconButton placed next to a
same-size Button looks proportional.
aria-label is a required prop. The type system enforces it: there is no way to construct an
IconButton without one.
Install
IconButton is exported from usemotif. No separate install.
API
IconButton
stablefunction IconButton(props: IconButtonProps): JSX.Element
Accessible label. The icon is `aria-hidden`, so this is the only name the button has.
The icon to render. May also be passed as the single child.
Visual weight — same axis as Button.
Semantic colour — same axis as Button.
Box dimensions (24 / 28 / 36 / 44 / 52px) and font size.
Loading state. Suppresses clicks, sets `aria-busy`, and swaps the icon for a loading indicator.
Every Pressable prop — `onPress`, `disabled`, style props, pseudo-state bags.
Variants
IconButton's matrix is Button's matrix — variant, intent, and size mean the same thing and
take the same values. The one difference is size: on IconButton it sets a square box dimension
rather than horizontal padding, since there is no label to pad around.
Accessibility
The icon is aria-hidden — its meaning is decorative as far as assistive technology is concerned.
That makes aria-label the entire accessible name of the button, which is why it is required and
not optional.
Write the label as the action, not the icon. "Delete" — not "trash can". "Close" — not "X". A screen-reader user hears the label; it should tell them what the button does, in the same words a visible text button would use.
Examples
A toolbar action:
A quiet, destructive variant:
A row of icon buttons: