Skip to content

Icon

A standardized SVG wrapper for the system’s glyphs and any icon you drop in.

<script>
import Icon from "@invisible-ui/svelte/Icon.svelte";
</script>

In Elements, pass the glyph as a path or wrap its shapes in an <svg>:

<ds-icon label="Done" path="M20 6 9 17l-5-5"></ds-icon>
<ds-icon>
<svg><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
</ds-icon>
PropTypeDefaultDescription
sizestring"1em"Width/height (scales with font-size by default).
viewBoxstring"0 0 24 24"SVG viewBox.
strokeWidthnumber | string2Stroke width in viewBox units.
labelstring | undefinedundefinedAccessible name; when omitted the icon is decorative.
animation"none" | "spin" | "pulse""none"Built-in animation for the glyph: spin (continuous rotation, e.g. a loader) or pulse (opacity beat, e.g. a live indicator). Both respect prefers-reduced-motion (the icon stays visible, static).
animationDurationstring | undefinedundefinedAnimation duration (any CSS time, e.g. "0.8s").
  • Decorative by default (aria-hidden); pass label to expose it as a role="img" with an accessible name.
  • Provide the glyph shapes (<path>, <line>, <polyline>, …) via the default slot.
<Icon label="Add">
<line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12" />
</Icon>