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
Full TypeScript signature sourced from the composable file.
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
Parameters
Input parameters accepted by this composable.
- propsrequiredRef<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
Return values
Properties and methods exposed by the composable return object.
- 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
Examples
Ready-to-paste usage snippets.
Register icons when creating the Origam plugin
Resolve an icon inside a component