Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
This component should be used when icons are meant to be clicked on.
It handles the two largest usecases we have for clickable icons: actions and toggles.
This is the go-to ButtonIcon for most generic actions.
If the button needs to hold an active / inactive state, then it is a Toggle.
Don’t use Toggles in series, opt for badge dropdowns instead.
This variant is only used when the button floats on top of content.
It could be it's sitting on top of a line connecting two nodes, or sticky on top of a draggable scene for instance.
ButtonIcons can display a "loading" state for asynchronous actions.
Only use when necessary to avoid multiple clicks when the action is not instant.
Skeletons are placeholders for UIs that are not yet ready but will feature a ButtonIcon.
The Loading state is for asynchronous tasks where the Button (and the button only) represents a pending state.
Skeleton needs are handled by the Skeleton component. Use SkeletonButtonIcon
or the right variant
prop on Skeleton
.
The Skeleton Documentation is over there!
All buttons have interactive states for "hover", "active" and "disabled". A focus ring should also be displayed on keyboard navigation.
All ButtonIcons carry a tooltip on hover. The content of that tooltip should be short ("do something") and effective.
You have access to three components with curated props for each.
Name | Description | Default | Control |
---|---|---|---|
children | - | ||
icon | In regular size, it supports both Icon (legacy) and SizedIcon<"M"> names. In size "XS", it supports the legacy icon name still, and the SizedIcon<"S"> names. | - | |
action | - | - | |
size | optional, defaults to M | - | |
onClick | A callback function - | - | - |
isLoading | optional - | - | |
disabled | optional - | - |
Name | Description | Default | Control |
---|---|---|---|
children | - | ||
icon | In regular size, it supports both Icon (legacy) and SizedIcon<"M"> names. In size "XS", it supports the legacy icon name still, and the SizedIcon<"S"> names. | - | |
action | - | - | |
size | optional, defaults to M | - | |
onClick | A callback function - | - | - |
isLoading | optional - | - | |
disabled | optional - | - | |
isActive | - | - |
Name | Description | Default | Control |
---|---|---|---|
children | - | ||
icon | In regular size, it supports both Icon (legacy) and SizedIcon<"M"> names. In size "XS", it supports the legacy icon name still, and the SizedIcon<"S"> names. | - | |
action | - | - | |
size | optional, defaults to M | - | |
onClick | A callback function - | - | - |
isLoading | optional - | - | |
disabled | optional - | - |
Of course all buttons can also use natural <button>
attributes (but not classNames
nor style
).
In order to be semantically correct, ButtonIconToggle
's active state is dependent on the aria-pressed
attribute being set to true
.
This attribute is transparent to consumers of the component and providing the mandatory isActive
prop will actually assign the correct aria-pressed
value.