Dashboard KPI
Show one primary measure with its period-over-period change.
Components / Display
A dashboard metric with independent direction, tone, context, and loading state.
Last changed in version 0.14.2: Improve keyboard navigation, action feedback, and selected colors across Vue components.
Revenue
€48,200
Orders
384
bunx --bun @getweini/cli@latest add statImport the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.
Revenue
€48,200
Orders
384
Refund rate
1.8%
<script setup lang="ts">
import Stat from './components/ui/stat/Stat.vue'
</script>
<template>
<div class="grid w-full max-w-3xl gap-4 sm:grid-cols-3">
<Stat label="Revenue" value="€48,200" change="12.5%" direction="up" description="this month" />
<Stat label="Orders" :value="384" change="8.2%" direction="up" description="this month" />
<Stat
label="Refund rate"
value="1.8%"
change="0.4%"
direction="down"
tone="positive"
description="this month"
/>
</div>
</template>Stat keeps a metric, optional trend, supporting text, icon slot, and loading state in one consistent dashboard surface.
Show one primary measure with its period-over-period change.
Build a responsive metric grid with matching loading geometry.
Set tone independently when a downward trend is desirable.
<script setup lang="ts">
import Stat from './components/ui/stat/Stat.vue'
</script>
<template>
<Stat
label="Refund rate"
value="1.8%"
change="0.4%"
direction="down"
tone="positive"
description="from last month"
/>
</template>Reserve the final card layout while data loads.
<script setup lang="ts">
import Stat from './components/ui/stat/Stat.vue'
</script>
<template>
<Stat label="Monthly revenue" loading aria-label="Loading monthly revenue" />
</template>Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.
| Name | Type or signature | Default | What it does |
|---|---|---|---|
asprop | "div" | "section" | "article" | undefined | "div" | Choose the HTML element or Vue component used for this control. |
labelprop | string | undefined | Not set | Visible or accessible name for this item. |
valueprop | string | number | undefined | Not set | Value represented by this control or option. |
descriptionprop | string | undefined | Not set | Controls the description behavior of Stat. |
changeprop | string | undefined | Not set | Controls the change behavior of Stat. |
directionprop | "up" | "down" | "neutral" | undefined | "neutral" | Choose the direction in which this control lays out or moves. |
toneprop | "neutral" | "positive" | "negative" | undefined | Not set | Controls the tone behavior of Stat. |
iconprop | Component | undefined | Not set | Icon content shown with this control. |
loadingprop | boolean | undefined | Not set | Show that an action is in progress and prevent repeat activation. |
sizeprop | "sm" | "md" | "lg" | undefined | "md" | Choose the visual size. Medium is the usual default where available. |
iconslot | (() => unknown) | undefined | Optional | Content for the icon area of Stat. |
labelslot | (() => unknown) | undefined | Optional | Content for the label area of Stat. |
valueslot | (() => unknown) | undefined | Optional | Content for the value area of Stat. |
trendslot | ((props: { direction: NonNullable<StatProps["direction"]>; tone: string; }) => unknown) | undefined | Optional | Content for the trend area of Stat. |
descriptionslot | (() => unknown) | undefined | Optional | Content for the description area of Stat. |
// packages/frameworks/vue/components/stat/types.ts
import type { Component } from 'vue'
export interface StatProps {
as?: 'div' | 'section' | 'article'
label?: string
value?: string | number
description?: string
change?: string
direction?: 'up' | 'down' | 'neutral'
tone?: 'positive' | 'negative' | 'neutral'
icon?: Component
loading?: boolean
size?: 'sm' | 'md' | 'lg'
}