useIcon
Icon
stable
Resolves a TIcon value (string, SVG path array, or component) into a TIconInstance containing the component to render and the resolved icon data. Consumes the Origam icon registry injected via createIcons.
API
Signature
Signature TypeScript complète extraite du fichier du composable.
useIcon throws if the Origam icon registry has not been provided (i.e. createOrigam was not called with an icon set). Raw SVG path data is auto-detected via a leading path-command character (M, L, C, …) and routed to OrigamSvgIcon.
API
Paramètres
Paramètres d'entrée acceptés par ce composable.
- propsrequisRef<TIcon | undefined>
- Reactive ref holding the icon value. Accepts an MDI class name string (e.g. "mdi-home"), an alias prefixed with "$" (e.g. "$checkboxOn"), an SVG path data string, an array of SVG path data strings, or a Vue component.
API
Valeurs de retour
Propriétés et méthodes exposées par l'objet retourné par le composable.
- iconData
- Computed instance describing which component to render (OrigamComponentIcon for class-based icons, OrigamSvgIcon for SVG paths) and the resolved icon value to pass as a prop.
Usage
Exemples
Extraits de code prêts à coller.
Register icons when creating the Origam plugin
Resolve an icon inside a component