Consistent sizing and tinting for consumer-supplied SVG icons. Decorative by default (aria-hidden); pass label to expose the icon as role=img when it carries meaning on its own.
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.
npx @slipstream-ui/cli@latest add iconProps
| Prop | Type | Default | Description |
|---|---|---|---|
| size | 'sm' | 'md' | 'lg' | 'xl' | 'md' | Icon edge length aligned to the spacing scale. |
| tone | 'default' | 'muted' | 'primary' | 'success' | 'warning' | 'info' | 'destructive' | 'default' | Semantic text color via currentColor. |
| icon | ComponentType<SVGProps<SVGSVGElement>> | — | Icon component to render; alternatively pass the SVG as children. |
| label | string | — | Accessible name; when set the icon is role=img instead of aria-hidden. |
| className | string | — | Additional CSS classes to apply. |
Anti-patterns
validate_usage is the MCP tool that rejects these mistakes: the same list agents see over MCP and in the canonical markdown.
Don't use Icon for text or interactive content
Icon only sizes and tints SVG artwork. Interactive elements belong in IconButton or Button.
tsx// Avoid<Icon onClick={...}><svg /></Icon>// Prefer<IconButton label="Settings" onClick={...}><SettingsIcon /></IconButton>
Accessibility
- aria-hidden by default; pass label for icons that convey meaning without adjacent text.
- Tones use semantic ink tokens audited for AA contrast on tinted surfaces.
Content guidelines
Icon labels
- Keep labels to one or two words
- Name the action or object, not the icon
- Match the label to the visible tooltip or adjacent text
Good examples
- Search
- Verified
- Delete item
Bad examples
- Magnifying glass icon
- Click here
Composition
Compose with IconButton: IconButton renders Icon children inside an accessible labeled control
<IconButton label="Search"><Icon icon={SearchIcon}/></IconButton>
Compose with IconTile: IconTile sizes descendant svg elements itself; plain SVG children work without Icon
<IconTile tone="primary"><ZapIcon/></IconTile>
Compose with Button: Button already sizes descendant svg at size-4; Icon adds tone and larger sizes
<Button><Icon size="lg" tone="primary" icon={StarIcon}/> New</Button>
Related components: IconButton, IconTile, SocialLinks, Button
Dependencies
What the registry installs alongside this component. Package imports already include these.
npm packages
- class-variance-authority
- clsx
- tailwind-merge
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+: macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA, the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.