import {KPI} from "@peakui-pro/react/kpi";// The card is a group named by its own title, so each one in a row announces its own metric.// `Actions` sits in the card's corner and is written outside the header.export default () => ( <KPI> <KPI.Header> <KPI.Icon /> <KPI.Title /> </KPI.Header> <KPI.Actions /> <KPI.Content> <KPI.Value value={0} /> <KPI.Trend /> </KPI.Content> <KPI.Chart data={[]} /> <KPI.Separator /> <KPI.Footer /> </KPI>);
A gap in the data is null, never 0: zero is a reading, and it drops the line to the floor.
// Without `connectNulls` the line breaks at the gap, which is what a reader should see.// With it, the line is drawn across — an estimate, so say so where the card is read.const data = [{value: 12400}, {value: 14100}, {value: null}, {value: 17800}];<KPI.Chart data={data} /><KPI.Chart connectNulls data={data} />
import {KPI} from "@peakui-pro/react/kpi";export function Basic() { return ( <div className="grid w-full grid-cols-2 gap-3">
Total Users
5,400
+33%
Total Sales
$15,400
0.0%
import {Persons, TriangleExclamation} from "@gravity-ui/icons";import {KPI} from "@peakui-pro/react/kpi";export function WithIcon() { return (
Conversion Rate
3.8%
+1.7%
import {CircleCheck} from "@gravity-ui/icons";import {KPI} from "@peakui-pro/react/kpi";export function WithActions() { return (
Total Subscribers
+122
71,897
import {Persons} from "@gravity-ui/icons";import {KPI} from "@peakui-pro/react/kpi";export function WithFooter() { return (
Server Load
38%
Disk Usage
98%
import {CircleCheck, TriangleExclamation} from "@gravity-ui/icons";import {KPI} from "@peakui-pro/react/kpi";export function WithProgress() { return (
Total Revenue
$228,451
+3.3%
import {KPI} from "@peakui-pro/react/kpi";import {SERIES} from "./_data.ts";export function WithChartBottom() {
Total Clicks
2,441
3.5%last 30d
import {ArrowUpRight} from "@gravity-ui/icons";import {TrendChip} from "@peakui-pro/react";import {KPI} from "@peakui-pro/react/kpi";import {SERIES} from "./_data.ts";
Total Revenue
$228,451
+3.3%
"use client"; // the chart is built from compound parts, which a server file cannot reachimport {AreaChart} from "@peakui-pro/react/area-chart";import {KPI} from "@peakui-pro/react/kpi";
Reported Revenue
$19,600
Estimated Revenue
$19,600
import {KPI} from "@peakui-pro/react/kpi";import {GAPPED} from "./_data.ts";export function WithChartConnectNulls() {