WlStatCard
Metric card with icon, label, value and description. Can include a progress bar.
Components / Data v0.1.0
Appearance
tone
accent
progress
icon
Default
Completed
24
Of 32 materials
Over the past week
Full example
<div class="wl-stack" data-space="md">
<WlStatCard
icon="task"
label="Completed"
value="24"
description="Of 32 materials"
:progress="75"
><template #footer>{{ "Over the past week" }}</template></WlStatCard>
</div>Content
label
value
description
Completed
24
Of 32 materials
Over the past week
Full example
<div class="wl-stack" data-space="md">
<WlStatCard
icon="task"
label="Completed"
value="24"
description="Of 32 materials"
:progress="75"
><template #footer>{{ "Over the past week" }}</template></WlStatCard>
</div>Metrics, tone and progress
Accent/success, label/description, progress, default slot value, footer and updating a metric.
Tasks completed
7
of 10 tasks in the local example
Team focus
Release plan
2 of 5 sections ready
Review time
1 h 20 min
during this session
The default slot replaces value. Add an explanation in the footer.
Full example
<script setup lang="ts">
import { WlButton, WlStatCard } from "legato-ui";
import { ref } from "vue";
const completed = ref(7);
</script>
<template>
<div class="wl-stack" data-space="lg">
<div class="showcase-stats">
<WlStatCard
icon="check"
label="Tasks completed"
:value="String(completed)"
description="of 10 tasks in the local example"
:progress="completed * 10"
tone="success"
/>
<WlStatCard
icon="eye"
label="Team focus"
value="Release plan"
description="2 of 5 sections ready"
:progress="40"
/>
<WlStatCard icon="clock" label="Review time" description="during this session">
<strong>{{ "1 h 20 min" }}</strong>
<template #footer>
<span class="wl-text-small wl-text-muted">
{{ "The default slot replaces value. Add an explanation in the footer." }}
</span>
</template>
</WlStatCard>
</div>
<div class="wl-inline" data-space="sm">
<WlButton size="sm" :disabled="completed === 10" @click="completed++">
{{ "Complete a task in this example" }}
</WlButton>
<WlButton size="sm" variant="ghost" @click="completed = 7">{{ "Restore initial metric" }}</WlButton>
</div>
</div>
</template>
<style scoped>
.showcase-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--wl-space-lg); }
</style>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 |
|---|---|---|---|
icon | WlIconInput | Not set | Label icon. |
label | string | Not set | Metric label. |
value | string | | Not set | Value (when no slot is provided). |
description | string | Not set | Description below the value. |
progress | number | Not set | Progress from 0 to 100. Displays an indicator when set. |
tone | WlStatCardTone | "accent" | Accent tone. |
numberFormat | Intl.NumberFormatOptions | Not set | Intl.NumberFormat options for the displayed numeric value. |
locale | string | Not set | Locale override for numeric display formatting. |
delta | string | Not set | Numeric change displayed beside the primary statistic. |
Events
No public events.
Slots
| Slot | Type / values | Content |
|---|---|---|
default | default?(props: {}): unknown; | Custom content instead of value. |
footer | footer?(props: {}): unknown; | Card footer. |
delta | delta?(props: { delta: string | | Custom statistic delta content; receives the displayed delta text. |
Keyboard and accessibility
- Label, value and description should explain the metric's unit and period.
- The default slot replaces the value; footer adds context. Do not compare metrics using tone colour alone.
- Progress creates an internal progressbar with a 0–100 value. Check its accessible name and explanation in your application.
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.