SvgIcon

Media
stable

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…

default

Rendering the live preview…

large

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamSvgIconSchematic of the SvgIcon component with 3 numbered internal parts. origam-icon--svg origam-icon__svg <svg viewBox="0 0 24 24"> <path :d="icon" /> 1 2 3
Anatomy of <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>). Carries origam-icon--svg, optional size class (origam-icon--size-{size}), and inline size style for numeric sizes.
2.origam-icon__svg
<svg> element. Always aria-hidden="true" and focusable="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 sets fill-opacity.

API

Props

All props accepted by this component, with their type, default value and description.

icon
TIcon
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.
id
string
class
string | Array<string> | object
disabled
boolean
false
Applies the disabled token colour and reduces opacity.
style
string | Array<string> | object | StyleValue
tag
string
'div'
HTML element rendered as the wrapper around the SVG. Defaults to div.
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.
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
false
Applies a border to the root wrapper.
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
height
number | string
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
Border-radius token applied to the root wrapper.
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | 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.

Source
color
currentColor
Default fill colour — inherits from the parent text colour.
dimension
var(--origam-font__size---md)
Size for the default size variant.
dimension
var(--origam-font__size---lg)
Size for the large variant.
duration
var(--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

vue

Multi-path icon

vue

Ecosystem

Family

Components from the same folder that share conventions and often compose together.