Icon buttons must have a name (which determines the icon), and can use variants to denote intent and importance.
To ensure your IconButton
implementation is accessible, it must have an accessibilityLabel
that describes the purpose of the button.
In cases where you're composing a button next to a label or some text that describes the buttons
action, you can setup your system using accessibilityLabelledBy
prop mapping to the id
on the
label node (See Composed example).
Composed example
As referenced above, if you're building a composed system, use the accessibilityLabelledBy
prop and an id
on the text node.
Loading state
Use the loading
prop to show a spinner when an action is in progress. The button becomes non-interactive and shows a loading spinner instead of the icon.
Sizing
IconButtons come in two sizes: compact (default) and regular. Use compact={false}
for larger touch targets.
A11y
Since icon buttons have no descriptive text or children, an accessibility label must be provided.