# Icon

Consistent sizing and tinting wrapper for consumer-supplied SVG icons

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

## Design intent

Icon gives every consumer icon one sizing and color contract: spacing-scale sizes, semantic tones, and decorative-by-default semantics so icon-only UI stays accessible when a label is supplied.

## Props

| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
| size | `'sm' | 'md' | 'lg' | 'xl'` | `md` | no | Icon edge length aligned to the spacing scale (14/16/20/24px rendered via SVG selectors) |
| tone | `'default' | 'muted' | 'primary' | 'success' | 'warning' | 'info' | 'destructive'` | `default` | no | Semantic text color applied to the icon via currentColor |
| icon | `ComponentType<SVGProps<SVGSVGElement>>` | — | no | Icon component to render; alternatively pass the SVG element as children |
| label | `string` | — | no | Accessible name; when set the icon is exposed as role=img instead of hidden |
| className | `string` | — | no | Additional CSS classes to apply |

## Examples

### Decorative icon in a button

Icon is aria-hidden; the button supplies the accessible name

```tsx
<Button variant="ghost" size="icon">
  <Icon icon={SearchIcon} />
</Button>
```

### Meaningful standalone icon

label exposes the icon as role=img for assistive tech

```tsx
<Icon icon={CheckCircleIcon} size="lg" tone="success" label="Verified" />
```

## Anti-patterns

- **Don't use Icon for text or interactive content** — Icon only sizes and tints SVG artwork. Interactive elements belong in IconButton or Button.

## Accessibility

- **Decorative by default**: aria-hidden=true unless label is provided, then role=img + aria-label
- **Color contrast**: Tones use semantic ink tokens audited for AA on tinted surfaces

## Composition

- Compose with **IconButton** — IconButton renders Icon children inside an accessible labeled control
  
  ```tsx
  <IconButton label="Search"><Icon icon={SearchIcon}/></IconButton>
  ```
- Compose with **IconTile** — IconTile sizes descendant svg elements itself; plain SVG children work without Icon
  
  ```tsx
  <IconTile tone="primary"><ZapIcon/></IconTile>
  ```
- Compose with **Button** — Button already sizes descendant svg at size-4; Icon adds tone and larger sizes
  
  ```tsx
  <Button><Icon size="lg" tone="primary" icon={StarIcon}/> New</Button>
  ```
- Related: IconButton, IconTile, SocialLinks, Button

