KPIGroup
Several metrics on one surface
Usage
import {KPIGroup} from "@peakui-pro/react";Anatomy
import {KPIGroup} from "@peakui-pro/react";
// The group ships from the package root: it imports no chart, so laying out metrics needs no
// charting library. Inside it a KPI card gives up its own background, shadow and radius — one
// surface, with a hairline between the metrics.
export default () => (
<KPIGroup aria-label="Email metrics">
<KPIGroup.Separator />
</KPIGroup>
);Examples
With From Suffix
Vertical
Customization
Tailwind CSS
<KPIGroup aria-label="Monthly totals" className="max-w-96" />Global CSS
@layer components {
.kpi-group {
--kpi-group-separator-color: var(--border-secondary);
--kpi-group-separator-inset: calc(var(--spacing) * 6);
}
}Styling Reference
PeakUI follows the BEM methodology, so variants and states are plain class names you can target.
CSS Classes
The KPIGroup component uses these CSS classes (view source styles):
Base & Orientation Classes
.kpi-group- The shared surface; the cards inside it drop their own.kpi-group--horizontal- Metrics side by side, each taking an equal share of the width.kpi-group--vertical- Metrics stacked
Element Classes
.kpi-group__separator- The hairline between two metrics
Slots
[data-slot="kpi-group"]- The group[data-slot="kpi-group-separator"]- A hairline
CSS Variables
| Variable | Purpose |
|---|---|
--kpi-group-separator-color | Colour of the hairline |
--kpi-group-separator-inset | How far a vertical hairline stops short of the group's edges |
API Reference
KPIGroup
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | 'horizontal' | 'vertical' | 'horizontal' | Which way the metrics are laid out, and which way the hairlines run |
children | ReactNode | - | The metrics and the hairlines between them |
aria-label | string | - | Names the set; each card inside already names its own metric |
className | string | - | Additional classes |
render | DOMRenderFunction<'div', undefined> | - | Replaces the rendered <div> with your own element |
...rest | ComponentProps<'div'> | - | Native <div> attributes. role is group and can be overridden |
KPIGroup.Separator
| Prop | Type | Default | Description |
|---|---|---|---|
aria-hidden | boolean | true | Hidden by default: it is decoration between metrics that already name themselves |
className | string | - | Additional classes |
render | DOMRenderFunction<'span', undefined> | - | Replaces the rendered <span> with your own element |
...rest | ComponentProps<'span'> | - | Native <span> attributes |