Appearance
OrigamSvgIcon
<OrigamSvgIcon> is the inline SVG leaf: when the resolved icon is a single SVG path string or an array of path entries, OrigamIcon selects this leaf to render the corresponding <svg> element directly in the DOM (no font-icon dependency, no external request).
Inline SVG is the most flexible rendering mode: paths are styled via fill: currentColor and the icon scales perfectly at any size.
Basic usage
vue
<template>
<!-- Single path -->
<OrigamSvgIcon icon="M12 2 L17 8 …" />
<!-- Multi-path (filled regions / outlines layered together) -->
<OrigamSvgIcon
:icon="[
'M12 2 L17 8 …',
['M12 2 L17 8 …', 0.5] /* second path with 50% opacity */
]"
/>
<!-- Or use the dispatcher (recommended) — same result -->
<OrigamIcon icon="M12 2 L17 8 …" />
</template>The icon prop shape:
ts
type TIcon =
| string // single path
| Array<string | [path: string, opacity: number]> // multiple paths
| Component // routed to OrigamComponentIconA bare string in the array → opaque path. A [path, opacity] tuple → that path is rendered with the given fill-opacity.
Sizes
vue
<template>
<OrigamSvgIcon icon="M12 2 …" size="x-small" />
<OrigamSvgIcon icon="M12 2 …" size="small" />
<OrigamSvgIcon icon="M12 2 …" size="default" />
<OrigamSvgIcon icon="M12 2 …" size="large" />
<OrigamSvgIcon icon="M12 2 …" size="x-large" />
<!-- Numeric override — pins the wrapper width / height in pixels -->
<OrigamSvgIcon icon="M12 2 …" :size="64" />
</template>The inner <svg> is sized as width: 1em; height: 1em so it follows the wrapper's font-size. Numeric size pins both wrapper and inner SVG to explicit pixel values.
Polymorphic tag
vue
<template>
<OrigamSvgIcon icon="M12 2 …" /> <!-- <div> -->
<OrigamSvgIcon icon="M12 2 …" tag="span" />
</template>viewBox
viewBox="0 0 24 24" is hardcoded on the inner SVG. All path data must therefore be authored on a 24×24 grid. If you need a different canvas, use OrigamComponentIcon and supply a full Vue SVG component instead.
Props (interface)
OrigamSvgIcon shares IIconComponentProps with the other four Icon leaves (OrigamIcon, OrigamClassIcon, OrigamComponentIcon, OrigamLigatureIcon). The full surface is wider than icon / size / tag: it also carries color, spacing, border, rounded and dimension — every one of them wired via a composable in OrigamSvgIcon.vue (see "Color / theming" below for the color channel, and the story's "Design" Variant for a live control on each).
ts
interface IIconComponentProps extends
IIconProps, IColorProps, IBgColorProps, ICommonsComponentProps,
ITagProps, ISizeProps, IPaddingProps, IMarginProps, IBorderProps,
IDimensionProps, IRoundedProps {
}| Group | Props |
|---|---|
| Icon (own) | icon: TIcon — string OR array (see above) |
| Color | color, bgColor |
| Sizing | size: TSize | number |
| Shape | rounded, roundedTopLeft, roundedTopRight, roundedBottomLeft, roundedBottomRight |
| Border | border, borderColor, borderStyle, borderTop, borderRight, borderBottom, borderLeft |
| Dimension | width, height, minWidth, minHeight, maxWidth, maxHeight |
| Spacing | padding, paddingTop/Right/Bottom/Left, paddingBlock, paddingInline, margin, marginTop/Right/Bottom/Left, marginBlock, marginInline |
| Functional | tag: string |
| Commons | id, class, style |
Anatomy
html
<div class="origam-icon origam-icon--svg origam-icon--size-default">
<svg
class="origam-icon__svg"
aria-hidden="true" <!-- "false" once a @click listener is attached (#660) -->
focusable="false"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M12 2 …" />
</svg>
</div>Color / theming
- Path elements inherit
fill: currentColor(set by the.origam-icon--svg .origam-icon__svgrule). - The wrapper's
colorprop (fromIColorProps, resolved byuseBothColor) sets the ambient text color the paths'currentColorresolves against — pass an intent (color="danger") or a custom value. Without it,colorcascades from an ancestor instead. bgColorpaints the wrapper's background (rarely needed on a bare icon, but available since it shares the same interface as every other leaf).- Per-path opacity is supported via the array tuple
[path, opacity].
When to use
- When you have raw SVG path data (e.g. extracted from Figma or a design system source-of-truth JSON).
- When you don't want to ship an icon font (
mdi,fa, …) for a few glyphs. - When you need multi-layer paths with per-path opacity — this is the only leaf that supports the
[path, opacity]tuple shape.
Accessibility
- The inner
<svg>hasaria-hidden="true"(norole) as long as the icon is decorative — it carries no meaning on its own, so it stays out of the accessibility tree. - ⛔ #660 — that attribute used to be HARDCODED, and this was the only leaf of the family that never called
useIconAccessibility(). A consumer writing<origam-svg-icon @click="…"/>got a working click handler on an element permanently invisible to assistive technology, with no dev warning to say so. The glyph now un-hides (aria-hidden="false") as soon as a@clicklistener is attached, exactly like the four sibling leaves. - Un-hiding is NOT the same as announcing a control: no
role="button"is added (see below), so the correct fix remainsorigam-btn. - For an interactive icon, prefer
<origam-btn icon="…" aria-label="…">(icon-only mode) over attaching@clickdirectly to an icon — since #653, no icon leaf addsrole="button"automatically. SeeOrigamIcon.md's Migrating off@clickon an icon (#653) section for the full rationale.
Related
OrigamIcon— the dispatcher (preferred entry-point).OrigamComponentIcon— wraps a full Vue SVG component when 24×24 isn't enough.