Icon
Thin wrapper around lucide-react icons that maps a tone prop to Clay's semantic icon-color tokens.
Install
Pull Icon from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Icon } from "@brika/clay";import { Icon } from "@brika/clay/components/icon";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
import { Icon } from '@brika/clay/components/icon';
import { Bell } from 'lucide-react';
/** Decorative icon, no `aria-label`, so screen readers skip it entirely. */
export default function IconDefaultDemo() {
return <Icon as={Bell} />;
}Icon, every way
Accessibility
- Decorative by default,
aria-hidden="true"is set when noaria-labelis provided. - Pass
aria-labelto make the icon carry standalone meaning (e.g. status indicator). - Do not use an icon alone as a button label, always pair with
aria-labelon the button.
Theme tokens
Every CSS variable Icon reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Icon
without touching component code.
Icon tokens
3 tokens--icon-mutedcolorvar(--muted-foreground)components.icon.mutedMuted icon color.
--icon-primarycolorvar(--primary)components.icon.primaryPrimary icon color (interactive accents).
--iconcolorvar(--foreground)components.icon.defaultDefault icon color.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.icon, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"icon": {
"muted": "var(--muted-foreground)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-icon-…) — see the
chips on each token row.
API reference
Props specific to Icon. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
- IconComponentThe icon component to render. Typically a
lucide-reacticon (e.g.Bell,AlertCircle) but anyReact.ComponentTypethat acceptsSVGProps<SVGSVGElement>is supported. - stringExtra class names merged onto the rendered SVG. Use this to override defaults or compose layout utilities, Clay merges with
tailwind-mergeso the caller's classes win on conflict. - sizedefault
'default'IconSizeVisual size of the icon. Maps to Tailwindsize-*utilities (xs→ 0.75rem,sm→ 0.875rem,default→ 1rem,lg→ 1.25rem). Defaults to'default'. - tonedefault
'default'IconToneSemantic color of the icon, mapped to one of Clay's icon-color tokens (--icon,--icon-muted,--icon-primary). Defaults to'default'.