Kpi
Loading example…
One metric: a label, a big number and an optional description. Fill it with props, or compose
Kpi.Label, Kpi.Value and Kpi.Description as children when the parts need their own
slots (a menu beside the label, a monospaced amount). card adds a border and radius.
Import
Section titled “Import”import { Kpi } from "@jcsoftdev/ui/containers";Single-component entry points tree-shake to just this component: @jcsoftdev/ui/containers/kpi.
<Kpi label="Citas hoy" value="12" description="3 pendientes" variant="default"/>| Prop | Type | Default | Description |
|---|---|---|---|
label |
ReactNode |
Short label describing the metric. Optional when you compose Kpi.Label as children. |
|
value |
ReactNode |
Highlighted number, already formatted by the consumer. Optional when you compose Kpi.Value. |
|
suffix |
ReactNode |
Small suffix next to the number, e.g. “/12”. | |
description |
ReactNode |
Optional subtext. | |
variant |
"danger" | "default" |
"default" |
|
tone |
KpiTone |
Colours the value and the label dot. Wins over variant. |
|
dot |
boolean |
false |
Leading dot on the label, in the tone’s colour. |
icon |
ReactNode |
Decorative icon at the end of the label row (aria-hidden). |
|
trailing |
ReactNode |
Interactive or labelled content at the end of the label row (a menu, a link); not hidden from assistive tech. | |
trend |
ReactNode |
Change indicator next to the value, e.g. a TrendChip. |
|
card |
boolean |
false |
Draws the tile as a card: border and radius. Off by default, so tiles in a KpiGroup stay flush. |
children |
ReactNode |
Compose the tile from Kpi.Label, Kpi.Value and Kpi.Description instead of (or after) the props. They are laid out in the tile’s column in the order written. |
|
classNames |
Partial<Record<KpiPart, string>> |
Per-part classes merged with cn; consumer classes win. className still targets the root and is merged last. |
* marks a required prop.
It also accepts the native props of the element or primitive it renders (for example className, id, aria-* and event handlers).
Storybook stories
Section titled “Storybook stories”Source
Section titled “Source”packages/ui/src/containers/kpi/kpi.tsx