IconButton
A square button component specifically designed for icon-only interactions. Automatically sizes to maintain perfect square proportions.Import
Props
The visual style variant of the icon button.Options:
primary- Filled accent color backgroundsecondary- Subtle gray background (default)tertiary- Glass-like appearance with shadow and blurghost- Transparent background, visible on hovericon- Accent-colored icon with transparent backgroundplain- Minimal style with subtle to strong color on hoverdanger- Destructive action styling with red background
The size of the icon button (applied to both width and height).Options:
3xs- 20px square (var(—space-20))2xs- 24px square (var(—space-24))xs- 28px square (var(—space-28))s- 32px square (var(—space-32))m- 36px square (var(—space-36))l- 40px square (var(—space-40))
Color tone applied to the icon.Feedback tones:
default- No tone appliedinfo- Information bluewarning- Warning amberdanger- Error redsuccess- Success green
red,orange,amber,yellow,lime,green,emeraldteal,cyan,sky,blue,indigo,violet,purplefuchsia,pink,rose
The icon element to display. Automatically sized to fit the button.
When true, disables interaction and applies disabled styling.
Additional CSS classes to apply to the button.
Explicit escape hatch for intentional structural overrides. Use with caution.
Usage
Basic Icon Button
Variants
Sizes
With Tone
Icon vs. Plain Variants
Theicon and plain variants are unique to IconButton:
Disabled State
Accessibility
- Always provide an
aria-labelsince IconButton has no visible text - Built on Base UI’s
Buttonprimitive with full keyboard support - Focus ring uses utility-focus-inner (1px) and utility-focus-outer (3px)
- Icon is wrapped with
aria-hidden="true"since the button itself has the label - Active state includes a subtle scale animation (0.98)
- Disabled buttons use
cursor-not-allowedand reduced opacity
Icon Sizing
IconButton automatically sizes the icon based on the button size:| Button Size | Icon Size |
|---|---|
| 3xs (20px) | 16px |
| 2xs (24px) | 16px |
| xs (28px) | 16px |
| s (32px) | 16px |
| m (36px) | 16px |
| l (40px) | 18px |
Design Tokens
The IconButton component uses the following design tokens: Colors:actions-primary-default,actions-primary-hover,actions-primary-disabledactions-secondary-default,actions-secondary-hover,actions-secondary-disabledactions-tertiary-default,actions-tertiary-hover,actions-tertiary-disabledactions-danger-default,actions-danger-hover,actions-danger-disabledcontent-strong,content-subtle,content-disabledcontent-link-default,content-link-hover
- Sizes:
space-20,space-24,space-28,space-32,space-36,space-40 - Icon sizes:
space-16,space-18
- Border radius:
radius-max(fully rounded) - Font weight:
font-weight-medium - Focus ring:
utility-focus-inner,utility-focus-outer - Shadows (tertiary):
utility-shadow-l1,utility-shadow-l2,utility-shadow-l3