Icon
Thin wrapper around a user-supplied icon component with token-driven size and color.
At a glance
- Icon-library-agnostic — pass any component matching
{ size?: number; color?: string }(lucide, RN-vector-icons, Heroicons, your own SVGs). - Pair with
SemanticIconsProviderto alias semantic keys (checkmark,close,spinner, …) to concrete icons. Components likeAlertandCheckboxresolve their default icons through this provider, so swapping the icon set in one place updates the whole library.
Preview
The example below uses the library's built-in defaultSemanticIcons. Drop in your own component (e.g. lucide-react's Star) by passing it to as.
Native preview
as
The icon component to render. Anything with the shape
(props: { size?: number; color?: string }) => ReactNode works.
If you're using the semantic icon registry, you usually won't pass
as directly — the components that need icons resolve them via
SemanticIconsProvider.
size
Pixel size. Defaults to 16. Pass a number; the icon component itself
chooses how to scale (most lucide / Heroicons render width={size}
height={size}).
color
CSS color string forwarded to the underlying icon component. Defaults
to the active theme's text.default. Override per-instance for
accents.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
as* | ComponentType<IconComponentProps> | — | — |
color | string | — | — |
size | IconSize | md | — |