WlIcon
SVG icon from Legato UI. Without name, displays a custom slot icon.
Components / Miscellaneous v0.1.0
Appearance
name
Default
size
Full example
<div class="wl-stack" data-space="md">
<WlIcon
name="folder"
:size="24"
role="img"
aria-label="Materials folder"
/>
</div>Content
title
Full example
<div class="wl-stack" data-space="md">
<WlIcon
name="folder"
:size="24"
role="img"
aria-label="Materials folder"
/>
</div>Sizes, compatible names and SVG slot
Catalogue names, sizes 14/18/24/32 and 1em, pi pi-search alias and a safe custom SVG.
plussearchchecktrashfolderbell14px18px24px32px 1em size
Compatible name pi pi-searchSVG in the default slot without name
Built-in SVGs are decorative. Label a meaningful icon on the button or on an outer role="img". The full catalog is in the Icons documentation section.
Full example
<script setup lang="ts">
import { WlIcon, type WlIconName } from "legato-ui";
const names = ["plus", "search", "check", "trash", "folder", "bell"] as const satisfies readonly WlIconName[];
</script>
<template>
<div class="wl-stack" data-space="lg">
<div class="wl-inline" data-space="lg"><span
v-for="name in names"
:key="name"
class="wl-stack"
data-space="xs"
><WlIcon :name="name" :size="24" /><code class="wl-text-small">{{ name }}</code></span></div>
<div class="wl-inline" data-space="md"><span
v-for="size in [14, 18, 24, 32]"
:key="size"
class="wl-inline"
data-space="xs"
>
<WlIcon name="search" :size="size" /><span class="wl-text-small">{{ size }}px</span>
</span><span class="wl-text-body"><WlIcon name="check" size="1em" /> {{ "1em size" }}</span></div>
<div class="wl-inline" data-space="md">
<span class="wl-inline" data-space="xs">
<WlIcon name="pi pi-search" />
<span class="wl-text-small">{{ "Compatible name pi pi-search" }}</span>
</span>
<span role="img" aria-label="Custom confirmation symbol">
<WlIcon :size="24">
<svg
viewBox="0 0 24 24"
width="24"
height="24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
aria-hidden="true"
><circle cx="12" cy="12" r="9" /><path d="m7 12 3 3 7-7" /></svg>
</WlIcon>
</span>
<span class="wl-text-small">{{ "SVG in the default slot without name" }}</span>
</div>
<p class="wl-text-small wl-text-muted">{{ "Built-in SVGs are decorative. Label a meaningful icon on the button or on an outer role=\"img\". The full catalog is in the Icons documentation section." }}</p>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
name | WlIconInput | Not set | Icon name from the set. |
size | number | | 18 | Size: number (px) or string (CSS), for example "1em". |
title | string | Not set | Accessible title for a meaningful icon. |
Events
No public events.
Slots
| Slot | Type / values | Content |
|---|---|---|
default | — | Custom icon; displayed when name is absent. |
Keyboard and accessibility
- Built-in SVG has aria-hidden=true; give a meaningful label to the button or an outer role=img.
- Name selects from the validated registry; the default slot is used without name. Numeric size is in px; a string may use 1em.
- Custom slot SVG must be a safe static image that inherits currentColor; the full catalogue and compatible names are available separately.
Keyboard and application responsibilities
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesIn your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.