Components
BaseKpiCard
A KPI with its value, change, comparison and a sparkline, in stacked or inline layout.
components/ui/kpi-cards/BaseKpiCard.vue
View in the demo
Layouts
Balance
$48,250.50
Churn rate
2.4%
Churn uses intent: 'down-is-good' so a drop shows in green.
The card adapts to its own width, not the window's: the label takes up to two lines before it is cut, the value shrinks only when the card is too narrow for it, and below 220px the icon moves above the label so it gets the full width. Three cards in a row next to the open sidebar stay readable.
Previous value, featured, loading and compact
Balance
$48,250.50
Previous month$49,794.12
Balance
$12,800
Balance
1,280
Balance
1,280
Balance
1,280
API
Props
Name | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | What the figure measures. |
layout | KpiCardLayout | "stacked" | stacked (chart under the value) or inline (chart beside it). |
density | KpiCardDensity | "comfortable" | comfortable or compact. |
value | string | number | BaseFormattedValueProps | — | A number, a string or BaseFormattedValue props. |
format | KpiValueFormat | — | number, currency, percent or duration. |
icon | string | — | An icon tile next to the label. |
chart-type | SparklineType | "none" | "area" | area, line, column or none. |
chart-color | string | CHART_SERIES_TOKENS[0] | A chart token such as chart-2. |
chart-curve | SparklineCurve | "smooth" | smooth or straight. |
previous-series | number[] | — | The previous period, drawn in stone. |
change | BaseTrendChipProps | — | { value, unit?, intent? } for the trend chip. |
comparison-label | string | — | Text after the change, such as “vs previous week”. |
previous-value | number | — | The previous figure, shown in the footer. |
previous-label | string | — | The label of the previous figure. |
loading | boolean | false | Shows the skeleton. |
featured | boolean | false | A highlighted version for the main KPI. |
series | ChartSeriesInput | — | The values of the sparkline. |
categories | (string | number)[] | — | Labels for the chart tooltip. |
Slots
Name | Slot props | Description |
|---|---|---|
#comparison | — | Replaces the change row. |
#chart | — | Replaces the sparkline. |
#default | — | Replaces the value. |
#previous-label | — | Replaces the previous value label. |
Figures use .kpi-value. Never pass hex colours: the chart takes the theme tokens.