Import
Usage
Props
Accessible label for the button. Required for screen readers since the button contains only an icon.
The icon or content to display inside the button. Typically an icon component.
Hidden when
loading is true (replaced with a spinner).The visual style variant of the button:
primary- Filled with primary color and shadowsecondary- Filled with secondary colorghost- Transparent background (default for icon buttons)destructive- Filled with destructive/danger color and shadowoutline- Transparent with border outline
The size of the square button:
xs- 28×28px (size-7), rounded-mdsm- 32×32px (size-8), rounded-mdmd- 36×36px (size-9), rounded-lglg- 40×40px (size-10), rounded-lgxl- 44×44px (size-11), rounded-xl
Whether the button is disabled. Disabled buttons have reduced opacity and cannot be clicked.
Whether the button is in a loading state. Replaces the icon with a spinner and disables interaction.
Callback function triggered when the button is clicked. Ignored when disabled or loading.
Additional CSS classes to apply to the button element.
Forward ref to the underlying button element.
Accessibility
- Required
aria-label: Since ActionIcon contains only an icon, thearia-labelprop is required to provide accessible text for screen readers - Uses semantic
<button>element withtype="button" - Sets
disabledandaria-disabledattributes when disabled or loading - Includes focus-visible ring for keyboard navigation
- Click handlers are properly disabled when button is disabled or loading
Styling
The ActionIcon component:- Is always square (width equals height)
- Uses
shrink-0to prevent flexbox shrinking - Centers content with
inline-flex items-center justify-center - Has smooth transitions (150ms ease-out)
- Includes focus ring with offset for keyboard navigation
- Shows hover and active states for all variants
- Has reduced opacity (50%) when disabled
Size-to-Icon Ratio
Recommended icon sizes for each button size:xs(28px): 12-14px iconsm(32px): 14-16px iconmd(36px): 16-18px iconlg(40px): 18-20px iconxl(44px): 20-24px icon