Charts
Area, bar and donut charts, KPI cards and sparklines, each with a data table for screen readers.
- Category
- Data & feedback
- Access
- Free with an account
- Source
- 489 lines · one file
- Added
- 4 Oct 2026
The decision inside it
A chart you cannot see is a table
Every chart renders its numbers as an sr-only table, so the data is there for a screen reader, not only the picture of it.
When to use it
Use the chart components for dashboards: AreaTrend for a value over time, BarCompare to compare categories, DonutBreakdown for parts of a whole, and KpiCard for a headline number with its change. Each chart renders a data table for screen readers from the same data, so the description prop is required.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Charts for this.
Install it: npx shadcn@latest add @liro/chart
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/chart.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
"use client";
import { AreaTrend, ChartCard, KpiCard } from "@/components/ui/chart";
const data = [
{ month: "Jan", revenue: 18400, refunds: 900 },
{ month: "Feb", revenue: 21300, refunds: 1100 },
{ month: "Mar", revenue: 24800, refunds: 950 },
];
export function RevenueChart() {
return (
<div className="grid gap-4">
<KpiCard label="Revenue" value="$24,800" delta={0.164} period="vs last month" trend={[18.4, 21.3, 24.8]} />
<ChartCard title="Revenue" subtitle="Last 3 months">
<AreaTrend
data={data}
xKey="month"
series={[
{ key: "revenue", label: "Revenue" },
{ key: "refunds", label: "Refunds" },
]}
format={(v) => `$${v.toLocaleString()}`}
description="Revenue rose from $18,400 in January to $24,800 in March."
/>
</ChartCard>
</div>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
title | React.ReactNode | Yes | – |
subtitle | React.ReactNode | No | – |
actions | React.ReactNode | No | Right side of the header: a range select, a menu. |
children | React.ReactNode | Yes | – |
Dependencies
npm packages
clsxlucide-reactrechartstailwind-mergeLiro foundations, installed alongside it
liro-themebuttonstateAccessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances