# IconButton

Square icon-only button built on Button with a required accessible label

> Component ID: `icon-button`
> Import: `import { IconButton } from '@slipstream-ui/core'`
> Docs: https://slipstreamui.com/docs/components/icon-button
> Registry: https://slipstreamui.com/registry/icon-button.json
> Tier: atom · Package: @slipstream-ui/core@0.16.0
> Manifest schema: v1 · manifest: v1

## Design intent

IconButton removes the footgun of unlabeled icon controls: label is a required prop mapped to aria-label, and sizes stay on the spacing scale. It composes Button so variants, loading and asChild behave identically.

## Props

| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
| label | `string` | — | yes | Accessible name for the control, rendered as aria-label |
| size | `'sm' | 'md' | 'lg'` | `md` | no | Square edge length: sm h-8, md h-10 (Button icon size), lg h-11. All Button variants, loading and asChild are inherited. |
| className | `string` | — | no | Additional CSS classes to apply |

## Examples

### Toolbar action

Compact ghost button in a dense toolbar

```tsx
<IconButton label="Delete row" variant="ghost" size="sm" onClick={remove}>
  <TrashIcon />
</IconButton>
```

### Loading state

Button semantics handle disabled + aria-busy while loading

```tsx
<IconButton label="Refresh data" loading={isFetching}>
  <RefreshIcon />
</IconButton>
```

## Anti-patterns

- **Don't pass icon-only content without label** — label is required by the type; omitting it is a compile error, not a runtime warning.

## Accessibility

- **Required accessible name**: label prop is required in TypeScript and rendered as aria-label
- **Keyboard and focus**: Inherits Button's focus-visible ring and disabled semantics

## Composition

- Compose with **Button** — IconButton composes Button size=icon and inherits variant/loading/asChild
  
  ```tsx
  <IconButton label="Refresh" variant="outline" loading={busy}><RefreshIcon/></IconButton>
  ```
- Compose with **Icon** — Wrap the icon child in Icon for tone and consistent sizing
  
  ```tsx
  <IconButton label="Delete"><Icon icon={TrashIcon} tone="destructive"/></IconButton>
  ```
- Related: Icon, Button, IconTile

