// 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 outputsTheme readyResponsive
Interactive playground

Configure Metric Card

Change any prop and inspect the server-rendered component immediately.

Live preview
Component code
<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 the typed payload.
Component props28 controls
Live examples

Designed for real product surfaces

Compare configurations and resize the browser to check responsive behavior.

Recommended

Operational KPI

Display one metric with a clear label, value, supporting description, and trend.

01
Live preview
Component usage.wrn
<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>
Compact

Progress metric

Add progress when a value is measured against a clear target.

02
Live preview
Component usage.wrn
<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>
Advanced

Selectable dashboard metric

Emit select and action events from interactive cards used in dashboards.

03
Live preview
Component usage.wrn
<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 outputs

Receive every typed component output

Use declarative output handlers in .wrn files or register a direct output handler from JavaScript. The canonical API exposes payload and does not require event.detail.

@selectFires when an item, option, card, or result is selected.
@actionFires when the component's primary or item action is activated.
Declarative handlers.wrn
<MetricCard
  @select='console.log(payload)'
  @action='console.log(payload)'
/>
Direct output handlers.js
import { registerOutputHandler } from "@wrnexus/csr/outputs"

const component = document.querySelector("[data-ui-component=\"MetricCard\"], [data-component=\"MetricCard\"]")

if (component) registerOutputHandler(component, "select", (payload) => {
  console.log("select", payload)
})

if (component) registerOutputHandler(component, "action", (payload) => {
  console.log("action", payload)
})
Component API

Props and configuration

All content and behavior shown above is supplied through these props and slots.

PropTypeDefaultRequired
labelstring"Metric"No
valuestring"0"No
descriptionstring""No
iconstring""No
iconStylestring"soft"No
prefixstring""No
suffixstring""No
badgestring""No
trendstring""No
trendLabelstring""No
trendDirectionstring"neutral"No
progressnumber-1No
progressLabelstring""No
hrefstring""No
targetstring""No
relstring""No
externalbooleanfalseNo
actionLabelstring""No
actionIconstring""No
showArrowbooleantrueNo
selectablebooleanfalseNo
disabledbooleanfalseNo
sizestring"default"No
colorstring"primary"No
variantstring"default"No
hoverstring"lift"No
alignstring"left"No
classstring""No
} }