Skip to content
esc

IconButton

Actionshadcn/ui

UnbuiltUI IconButton: a square Button with only an icon. The label prop is required and becomes aria-label and tooltip.

When to use

  • Use it in AppBar actions, card corners and toolbars.
  • Use universally known icons only (back, close, search, more).
  • Don't use an icon alone for an action that is not obvious; use a Button with text.
  • Don't put more than 3 IconButtons in one bar.

Accessibility

Role
button
Keyboard
Enter and Space activate.
Notes
label is required, so the control always has an accessible name.

Props

  • label

    string

    What the button does ('Notifications', 'Close'); required.

  • variant= 'ghost'

    Button variant

    Visual weight.

  • size= 'default'

    'sm' | 'default' | 'lg'

    Square size.

Prompt for your agent

Use the UnbuiltUI IconButton. Call unbuilt_get_component("IconButton") first and follow its spec: variants, states, usage rules and accessibility.

unbuilt_get_component returns

9 variants5 states3 props4 usage rules2 a11y notes6 tokens1 example

Add it with shadcn

$npx shadcn add https://unbuiltui.com/r/icon-button.json

Tokens · 6

bg.subtlebg.inversefg.defaultborder.focusradius.mdradius.sm