SvgIcon
Renders an inline SVG path icon. Accepts a single path string or an array of multi-path entries with optional fill-opacity values.
Preview
Rendering the live preview…
defaultRendering the live preview…
largeStructure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-svg-icon> — 3 internal parts. The root wrapper carries size and colour classes; the inner <svg> is aria-hidden and renders one or more <path> elements.- 1.origam-icon.origam-icon--svg
- Root wrapper element (default
<div>). Carriesorigam-icon--svg, optional size class (origam-icon--size-{size}), and inline size style for numeric sizes. - 2.origam-icon__svg
<svg>element. Alwaysaria-hidden="true"andfocusable="false". viewBox is fixed at 24x24.fill: currentColor— inherits colour from the parent.- 3path
- One or more
<path>elements. For multi-path arrays the second tuple value setsfill-opacity.
API
Props
All props accepted by this component, with their type, default value and description.
- iconTIcon
- SVG path data. Pass a single path string for a single-path icon, or an array of [path, fillOpacity?] tuples for multi-path icons.
- color
- Icon fill colour. Accepts a semantic intent token or a CSS colour. Defaults to currentColor so the icon inherits the parent text colour.
- bgColor
- Background colour of the root wrapper element.
- idstring
- classstring | Array<string> | object
- disabledbooleanfalse
- Applies the disabled token colour and reduces opacity.
- stylestring | Array<string> | object | StyleValue
- tagstring'div'
- HTML element rendered as the wrapper around the SVG. Defaults to div.
- size
- Icon size. Accepts a named size token (x-small, small, default, large, x-large) which applies a size class, or a number converted to px as an inline style.
- paddingboolean | number | string
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>false
- Applies a border to the root wrapper.
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- heightnumber | string
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | string
- Border-radius token applied to the root wrapper.
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to a child component.
- Ref<string>
- Reactive CSS string generated by useStyle from the computed icon styles.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet into the document. Called automatically on mount.
- () => void
- Removes the injected style sheet. Called automatically on unmount.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Icon fill colour. Defaults to currentColor so the icon inherits the parent text colour.
- Icon size when size="x-small".
- Icon size when size="small".
- Icon size when size="default".
- Icon size when size="large".
- Icon size when size="x-large".
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
Notes
- The inner <svg> element always carries aria-hidden="true" and focusable="false". The icon is decorative — the parent element must provide a meaningful aria-label when the icon conveys information.
- SVG paths inherit fill: currentColor. Ensure the surrounding text colour meets WCAG AA contrast ratio against the background.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- colorcurrentColor
- Default fill colour — inherits from the parent text colour.
- dimensionvar(--origam-font__size---md)
- Size for the default size variant.
- dimensionvar(--origam-font__size---lg)
- Size for the large variant.
- durationvar(--origam-motion__duration---fast)
- Transition duration for colour changes.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Basic SVG path icon
Multi-path icon
Ecosystem
Family
Components from the same folder that share conventions and often compose together.