// Generated by scripts/generate-showcase.mjs. Do not edit directly.
page MetricCardDetail {
layout = "showcase"
state playground_label = ctx.url.searchParams.get("pg_label") ?? "Metric Card"
state playground_value = ctx.url.searchParams.get("pg_value") ?? "sample-1"
state playground_description = ctx.url.searchParams.get("pg_description") ?? "A polished default metric card for a modern application."
state playground_icon = ctx.url.searchParams.get("pg_icon") ?? ""
state playground_iconStyle = ctx.url.searchParams.get("pg_iconStyle") ?? "soft"
state playground_prefix = ctx.url.searchParams.get("pg_prefix") ?? ""
state playground_suffix = ctx.url.searchParams.get("pg_suffix") ?? ""
state playground_badge = ctx.url.searchParams.get("pg_badge") ?? ""
state playground_trend = ctx.url.searchParams.get("pg_trend") ?? ""
state playground_trendLabel = ctx.url.searchParams.get("pg_trendLabel") ?? "Metric Card"
state playground_trendDirection = ctx.url.searchParams.get("pg_trendDirection") ?? "neutral"
state playground_progress = Number(ctx.url.searchParams.get("pg_progress") ?? "-1")
state playground_progressLabel = ctx.url.searchParams.get("pg_progressLabel") ?? "Metric Card"
state playground_href = ctx.url.searchParams.get("pg_href") ?? "#metric-card-demo"
state playground_target = ctx.url.searchParams.get("pg_target") ?? ""
state playground_rel = ctx.url.searchParams.get("pg_rel") ?? ""
state playground_external = (ctx.url.searchParams.get("pg_external") ?? "false") === "true"
state playground_actionLabel = ctx.url.searchParams.get("pg_actionLabel") ?? "Metric Card"
state playground_actionIcon = ctx.url.searchParams.get("pg_actionIcon") ?? ""
state playground_showArrow = (ctx.url.searchParams.get("pg_showArrow") ?? "true") === "true"
state playground_selectable = (ctx.url.searchParams.get("pg_selectable") ?? "false") === "true"
state playground_disabled = (ctx.url.searchParams.get("pg_disabled") ?? "false") === "true"
state playground_size = ctx.url.searchParams.get("pg_size") ?? "default"
state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary"
state playground_variant = ctx.url.searchParams.get("pg_variant") ?? "default"
state playground_hover = ctx.url.searchParams.get("pg_hover") ?? "lift"
state playground_align = ctx.url.searchParams.get("pg_align") ?? "start"
state playground_class = ctx.url.searchParams.get("pg_class") ?? "showcase-instance showcase-instance--1"
seo {
title = "Metric Card"
description = "Display one operational metric with value, suffix, description, icon, trend, progress, and optional action."
}
view {
Data component
Metric Card
Display one operational metric with value, suffix, description, icon, trend, progress, and optional action.
28 props2 slots2 eventsTheme readyResponsive
Interactive playgroundConfigure Metric Card
Change any prop and inspect the server-rendered component immediately.
Live preview
<MetricCard
label="Metric Card"
value="sample-1"
description="A polished default metric card for a modern application."
trendLabel="Metric Card"
progressLabel="Metric Card"
href="#metric-card-demo"
actionLabel="Metric Card"
align="start">
<div data-slot="footer">
<div class="showcase-slot">footer slot</div>
</div>
</MetricCard>
Event outputInteract with the preview to inspect event.detail.
Live examplesDesigned for real product surfaces
Compare configurations and resize the browser to check responsive behavior.
<MetricCard
label="Availability"
value="99.9"
description="Target service availability."
icon="icon-[lucide--activity]"
suffix="%"
trend="Stable"
trendLabel="30 days"
trendDirection="positive"
progressLabel="Metric Card"
href="#status"
actionLabel="Open status"
color="success"
align="start">
<div data-slot="footer">
<div class="showcase-slot">footer slot</div>
</div>
</MetricCard>
<MetricCard
label="Profile completion"
value="72"
description="Complete the remaining account and security steps."
icon="icon-[lucide--circle-user-round]"
suffix="%"
trendLabel="Compact example"
progress="72"
progressLabel="Account setup"
href="#metric-card-demo"
actionLabel="Compact example"
size="sm"
color="info"
variant="soft"
align="center">
<div data-slot="footer">
<div class="showcase-slot">footer slot</div>
</div>
</MetricCard>
<MetricCard
label="Open complaints"
value="38"
description="Cases waiting for review or assignment."
icon="icon-[lucide--inbox]"
badge="Needs review"
trendLabel="Advanced example"
progressLabel="Advanced example"
href="#queue"
actionLabel="Review queue"
selectable="true"
size="lg"
color="warning"
variant="raised"
hover="glow"
align="end">
<div data-slot="footer">
<div class="showcase-slot">footer slot</div>
</div>
</MetricCard>
Component eventsRespond to every public interaction
Use declarative @event handlers in .wrn files or subscribe to the bubbling browser events from JavaScript.
@selectFires when an item, option, card, or result is selected.
@actionFires when the component's primary or item action is activated.
<MetricCard
@select='console.log(event.detail)'
@action='console.log(event.detail)'
/>
const component = document.querySelector("[data-ui-component=\"MetricCard\"], [data-component=\"MetricCard\"]")
component?.addEventListener("select", (event) => {
console.log("select", event.detail)
})
component?.addEventListener("action", (event) => {
console.log("action", event.detail)
})
Component APIProps and configuration
All content and behavior shown above is supplied through these props and slots.
| Prop | Type | Default | Required |
|---|
label | string | "Metric" | No |
value | string | "0" | No |
description | string | "" | No |
icon | string | "" | No |
iconStyle | string | "soft" | No |
prefix | string | "" | No |
suffix | string | "" | No |
badge | string | "" | No |
trend | string | "" | No |
trendLabel | string | "" | No |
trendDirection | string | "neutral" | No |
progress | number | -1 | No |
progressLabel | string | "" | No |
href | string | "" | No |
target | string | "" | No |
rel | string | "" | No |
external | boolean | false | No |
actionLabel | string | "" | No |
actionIcon | string | "" | No |
showArrow | boolean | true | No |
selectable | boolean | false | No |
disabled | boolean | false | No |
size | string | "default" | No |
color | string | "primary" | No |
variant | string | "default" | No |
hover | string | "lift" | No |
align | string | "left" | No |
class | string | "" | No |
}
}