Skip to content

IconButton

Square, icon-only button built on Button; takes an icon node and a required label that's applied as aria-label and enforces type="button" by default.

  • stable
  • since v0.1.0
  • 2.28 kB
  • forms
  • button

Requires a string label which is applied as aria-label; the icon child should be aria-hidden so screen readers only announce the label.

Preview
Open
tsx

solid, soft, outline, ghost, and link mirror the Button variants. bare opts out of the Button recipe entirely and renders a plain <button> — useful for close buttons on dialogs that own their own styling.

Preview
Open
tsx

xs, sm, md (default), lg, and xl.

Preview
Open
tsx

Pair variant with colorScheme (accent, neutral, success, warning, danger).

Preview
Open
tsx

shape defaults to square for IconButton — set shape="pill" for a circular icon button.

Preview
Open
tsx
Preview
Open
tsx
PropTypeDefaultDescription
colorScheme
"accent"|"neutral"|"success"|"danger"|"warning"
"accent"
Colour palette. `accent` is the brand colour; semantic schemes carry meaning (`danger` for destructive actions, `success` for confirmations).
size
"xs"|"sm"|"md"|"lg"|"xl"
"md"
Control size — affects height, padding, font size, and icon size. Available: `xs`, `sm`, `md`, `lg`, `xl`.
shape
"default"|"square"|"pill"
"default"
Geometry preset. `square` removes horizontal padding for icon-only buttons; `pill` rounds the corners to a fully-rounded radius.
fullWidth
boolean
Stretches the button to fill its container's inline size.
loading
boolean
false
Renders a spinner inside the button and blocks interaction. The `disabled` and `aria-busy` attributes are set automatically.
asChild
boolean
When `true`, merges props onto the immediate child (Radix `Slot` pattern) instead of rendering a `<button>`. Useful for rendering `<Link>`s that look like buttons.
className
string
style
CSSProperties
variant
"link"|"solid"|"soft"|"outline"|"ghost"|"bare"
icon*
ReactNode
The icon element — typically a Cynosure icon or an inline SVG.
label*
string
Accessible label — announced in place of textual content. Required.
  • label is required and forwarded as aria-label — there is no visible text content, so the label is the control’s accessible name.
  • The component enforces type="button" by default to prevent accidental form submission.
  • Mark the inner SVG aria-hidden="true" so screen readers don’t announce a duplicate of the label.
  • shape defaults to square; the underlying Button still keeps a comfortable hit target at every size.
  • Pair with a Tooltip to surface the label on hover for sighted users while keeping it announced to assistive tech.
  • Use variant="bare" for close / clear buttons inside dialogs and inputs where a parent recipe owns the styling.
  • Match the SVG stroke to currentColor so the icon picks up the button’s contextual colour.
  • Drop IconButtons into a ButtonGroup for compact toolbars — variant and size flow through the group context.