Web · Components
Icon
Renders an IconProp value.
Import
Renders an IconProp value. A name is looked up in the icon library given to UIProvider; an element is rendered as-is. Hidden from screen readers (decorative); put text or an aria-label next to icons that carry meaning.
Use it when your own component should accept an icon prop like the library's components do.
Examples
IconProps
interfaceProps of the Icon component.
| Name | Type | Description |
|---|---|---|
icon | IconProp | The icon's name or the icon itself. See IconProp. |
className? | string | Classes for the icon resolved by name (e.g. size-5 text-primary). |
Register
interfaceInterface extended to introduce the project's icon library to the library. Once extended, every prop taking icon="..." accepts only names from that library and the editor suggests them.
Examples
IconComponent
typeIcon component. Components from libraries such as lucide-react, @phosphor-icons/react, react-icons, @heroicons/react and your own SVG components fit: any component that takes className and aria-hidden.
IconRegistry
typeIcon components by name: { save: SaveIcon, trash: TrashIcon }.
IconName
typeNames in the icon library given to UIProvider. If Register is not extended, any string is accepted.
IconProp
typeType of icon props. Can be given in two forms:
- Name:
icon="save". Resolved from the icon library given toUIProvider; names are type-checked ifRegisteris extended. - Element:
icon={<SaveIcon />}or any React content.
Passing false or null shows no icon (to hide the default icon on components that have one).