Icon
When to use it
Use the Icon component when a Vue application needs a shared UI-framework icon. The component references the generated SVG sprite, so SVG path data is not bundled into application JavaScript.
For .NET/Razor or plain HTML, use the same sprite directly with .c-icon.
Place an Icon directly inside a .c-button to use the button's default icon size. Set size for a smaller or narrower icon.
What it looks like
Code examples
<script setup>
import { Icon } from '@tickster/ui-framework/library.mjs';
</script>
<template>
<Icon name="copy" />
<Icon name="warning" size="20x20" />
<Icon name="trash" label="Delete" />
<button type="button" class="c-button">
<Icon name="copy" />
Copy
</button>
</template><script setup>
import Icon from '@tickster/ui-framework/components/Icon.mjs';
</script>
<template>
<Icon name="search" />
</template>import UiFramework from '@tickster/ui-framework/library.mjs';
app.use(UiFramework, {
iconSpritePath: '/assets/vendor/ui-framework/img/sprite.symbol.svg',
});<svg class="c-icon" aria-hidden="true" focusable="false" fill="currentColor">
<use
href="/assets/vendor/ui-framework/symbol/svg/sprite.symbol.svg#check"
xlink:href="/assets/vendor/ui-framework/symbol/svg/sprite.symbol.svg#check"
></use>
</svg>Props
| Prop | Default | Description |
|---|---|---|
name | required | Icon id from the generated UI-framework sprite. |
size | 24px outside buttons | Number in pixels, CSS length, or a pair such as 16x24. A direct button icon uses the button's default when omitted. |
label | '' | Accessible label for meaningful icons. |
title | '' | Compatibility alias for label. |
spritePath | /assets/vendor/ui-framework/symbol/svg/sprite.symbol.svg | Override for applications with another public asset path. |
fill | currentColor | Optional SVG presentation override. Prefer CSS color for normal UI icons. |
stroke | null | Optional SVG presentation override. Prefer CSS color for normal UI icons. |
Accessibility
Icons are decorative by default and render with aria-hidden="true". Add label when the icon itself communicates meaning that is not already present in nearby text.
Color
Standard UI icons should follow currentColor, so light and dark mode should be handled by the text color of the surrounding UI. Do not duplicate icons for light and dark mode unless the artwork itself changes.