Bklit UI
Composable chart components for React, distributed via the @bklit shadcn registry. Charts are installed as source into the user's project.
IMPORTANT: Run shadcn CLI commands with the project's package runner: npx shadcn@latest, pnpm dlx shadcn@latest, or bunx --bun shadcn@latest.
Current Project Context
!`npx shadcn@latest info --json`
Use the JSON above for framework, aliases, Tailwind version, installed components, and resolved paths. Confirm the @bklit registry is configured before adding charts.
Principles
- Install before inventing. Use
npx shadcn@latest add @bklit/<chart> — charts are registry components, not hand-rolled SVG.
- Compose, don't flatten. Root chart →
Grid → series → axes → ChartTooltip. See composition.md.
- Theme with tokens. Use
chartCssVars and --chart-* variables — never hardcode one-off colors. See theming.md.
- Read the doc page first. Each chart has props, data shape, and examples at
https://ui.bklit.com/docs/components/<slug>.
- Browse variants. Gallery:
https://ui.bklit.com/charts/<slug> — Studio: https://ui.bklit.com/studio?chart=<slug>.
Critical Rules
These rules are always enforced. Each links to Incorrect/Correct examples.
- Series and axes live inside the root chart —
LineChart, BarChart, AreaChart, etc.
- One root per chart — use
ComposedChart for mixed series types.
- Grid before series so lines/bars render above grid lines.
ChartTooltip as a chart child — required for crosshair and hover context.
- Use
chartCssVars from @bklitui/ui/charts instead of raw "var(--chart-…)" strings.
- Series palette:
--chart-1 … --chart-5 for multi-series charts.
- Tooltip surfaces:
bg-popover text-popover-foreground — avoids white-on-white in light mode.
- Default duration ~1100ms for cartesian enter animations unless the doc specifies otherwise.
- Replay: change
revealSignature or remount with a new key.
- Live charts: use
paused on LiveLineChart to debug without stopping the rAF loop manually.
- Custom content via
ChartTooltip content prop or children patterns from docs.
indicatorColor function for candlestick / dynamic crosshair colors.
- Custom indicators: use
useChart() — do not track mouse globally outside chart context.
- Require
@bklit registry in components.json.
- Install:
npx shadcn@latest add @bklit/<slug>.
- Let the CLI install peer dependencies — do not pin
@visx/* / motion manually unless resolving a conflict.
Chart Catalog
Workflow
- Run
npx shadcn@latest info --json — verify @bklit registry and aliases.
- Pick a chart from the catalog (or ask the user what story the data tells).
- Open the doc URL for data shape and props.
- If not installed:
npx shadcn@latest add @bklit/<slug>.
- Compose with grid, series, axes, tooltip — apply theming tokens.
- Point the user to the gallery or Studio URL for variant inspiration.
Quick Reference
# Project info
npx shadcn@latest info --json
# Add a chart
npx shadcn@latest add @bklit/line-chart
# Search registries (if configured)
npx shadcn@latest search @bklit
import { LineChart, Line, Grid, XAxis, ChartTooltip, chartCssVars } from "@bklitui/ui/charts";
<LineChart data={data} xDataKey="date">
<Grid horizontal />
<Line dataKey="users" stroke={chartCssVars.linePrimary} />
<XAxis />
<ChartTooltip />
</LineChart>
Utility docs
Detailed References
1---2name: bklit-ui3description: Bklit UI charts and data visualization for any project using the @bklit shadcn registry. Install, compose, theme, and animate charts correctly. Triggers when working with @bklitui/ui/charts, @bklit components, data visualization, dashboards, or chart theming. Also invoke manually for chart tasks.4---5
6# Bklit UI
7
8Composable chart components for React, distributed via the `@bklit` shadcn registry. Charts are installed as source into the user's project.
9
10> **IMPORTANT:** Run shadcn CLI commands with the project's package runner: `npx shadcn@latest`, `pnpm dlx shadcn@latest`, or `bunx --bun shadcn@latest`.
11
12## Current Project Context
13
14```json
15!`npx shadcn@latest info --json`
16```
17
18Use the JSON above for framework, aliases, Tailwind version, installed components, and resolved paths. Confirm the `@bklit` registry is configured before adding charts.
19
20## Principles
21
221. **Install before inventing.** Use `npx shadcn@latest add @bklit/<chart>` — charts are registry components, not hand-rolled SVG.
232. **Compose, don't flatten.** Root chart → `Grid` → series → axes → `ChartTooltip`. See [composition.md](./rules/composition.md).
243. **Theme with tokens.** Use `chartCssVars` and `--chart-*` variables — never hardcode one-off colors. See [theming.md](./rules/theming.md).
254. **Read the doc page first.** Each chart has props, data shape, and examples at `https://ui.bklit.com/docs/components/<slug>`.
265. **Browse variants.** Gallery: `https://ui.bklit.com/charts/<slug>` — Studio: `https://ui.bklit.com/studio?chart=<slug>`.
27
28## Critical Rules
29
30These rules are **always enforced**. Each links to Incorrect/Correct examples.
31
32### Composition → [composition.md](./rules/composition.md)
33
34- **Series and axes live inside the root chart** — `LineChart`, `BarChart`, `AreaChart`, etc.
35- **One root per chart** — use `ComposedChart` for mixed series types.
36- **Grid before series** so lines/bars render above grid lines.
37- **`ChartTooltip` as a chart child** — required for crosshair and hover context.
38
39### Theming → [theming.md](./rules/theming.md)
40
41- **Use `chartCssVars`** from `@bklitui/ui/charts` instead of raw `"var(--chart-…)"` strings.
42- **Series palette:** `--chart-1` … `--chart-5` for multi-series charts.
43- **Tooltip surfaces:** `bg-popover text-popover-foreground` — avoids white-on-white in light mode.
44
45### Animation → [animation.md](./rules/animation.md)
46
47- **Default duration ~1100ms** for cartesian enter animations unless the doc specifies otherwise.
48- **Replay:** change `revealSignature` or remount with a new `key`.
49- **Live charts:** use `paused` on `LiveLineChart` to debug without stopping the rAF loop manually.
50
51### Tooltips → [tooltips.md](./rules/tooltips.md)
52
53- **Custom content via `ChartTooltip` `content` prop** or children patterns from docs.
54- **`indicatorColor` function** for candlestick / dynamic crosshair colors.
55- **Custom indicators:** use `useChart()` — do not track mouse globally outside chart context.
56
57### Installation → [installation.md](./rules/installation.md)
58
59- **Require `@bklit` registry** in `components.json`.
60- **Install:** `npx shadcn@latest add @bklit/<slug>`.
61- **Let the CLI install peer dependencies** — do not pin `@visx/*` / `motion` manually unless resolving a conflict.
62
63## Chart Catalog
64
65| Slug | Use when | Install | Docs | Gallery |
66|------|----------|---------|------|---------|
67| `area-chart` | Trends with filled regions under lines | `@bklit/area-chart` | [/docs/components/area-chart](https://ui.bklit.com/docs/components/area-chart) | [/charts/area-chart](https://ui.bklit.com/charts/area-chart) |
68| `bar-chart` | Category comparisons, stacked or grouped bars | `@bklit/bar-chart` | [/docs/components/bar-chart](https://ui.bklit.com/docs/components/bar-chart) | [/charts/bar-chart](https://ui.bklit.com/charts/bar-chart) |
69| `line-chart` | Time series, multi-line trends, markers | `@bklit/line-chart` | [/docs/components/line-chart](https://ui.bklit.com/docs/components/line-chart) | [/charts/line-chart](https://ui.bklit.com/charts/line-chart) |
70| `live-line-chart` | Streaming / real-time data | `@bklit/live-line-chart` | [/docs/components/live-line-chart](https://ui.bklit.com/docs/components/live-line-chart) | [/charts/live-line-chart](https://ui.bklit.com/charts/live-line-chart) |
71| `composed-chart` | Mixed bar + line (or similar) on one axis | `@bklit/composed-chart` | [/docs/components/composed-chart](https://ui.bklit.com/docs/components/composed-chart) | [/charts/composed-chart](https://ui.bklit.com/charts/composed-chart) |
72| `scatter-chart` | Correlation, distribution, bubble sizing | `@bklit/scatter-chart` | [/docs/components/scatter-chart](https://ui.bklit.com/docs/components/scatter-chart) | [/charts/scatter-chart](https://ui.bklit.com/charts/scatter-chart) |
73| `candlestick-chart` | OHLC financial data, brushes | `@bklit/candlestick-chart` | [/docs/components/candlestick-chart](https://ui.bklit.com/docs/components/candlestick-chart) | [/charts/candlestick-chart](https://ui.bklit.com/charts/candlestick-chart) |
74| `pie-chart` | Part-to-whole slices | `@bklit/pie-chart` | [/docs/components/pie-chart](https://ui.bklit.com/docs/components/pie-chart) | [/charts/pie-chart](https://ui.bklit.com/charts/pie-chart) |
75| `ring-chart` | Donut / ring KPIs | `@bklit/ring-chart` | [/docs/components/ring-chart](https://ui.bklit.com/docs/components/ring-chart) | [/charts/ring-chart](https://ui.bklit.com/charts/ring-chart) |
76| `radar-chart` | Multi-axis comparison | `@bklit/radar-chart` | [/docs/components/radar-chart](https://ui.bklit.com/docs/components/radar-chart) | [/charts/radar-chart](https://ui.bklit.com/charts/radar-chart) |
77| `gauge-chart` | Single-value KPI dial | `@bklit/gauge-chart` | [/docs/components/gauge-chart](https://ui.bklit.com/docs/components/gauge-chart) | [/charts/gauge-chart](https://ui.bklit.com/charts/gauge-chart) |
78| `funnel-chart` | Stage conversion funnels | `@bklit/funnel-chart` | [/docs/components/funnel-chart](https://ui.bklit.com/docs/components/funnel-chart) | [/charts/funnel-chart](https://ui.bklit.com/charts/funnel-chart) |
79| `sankey-chart` | Flow between nodes | `@bklit/sankey-chart` | [/docs/components/sankey-chart](https://ui.bklit.com/docs/components/sankey-chart) | [/charts/sankey-chart](https://ui.bklit.com/charts/sankey-chart) |
80| `choropleth-chart` | Geo regions colored by value | `@bklit/choropleth-chart` | [/docs/components/choropleth-chart](https://ui.bklit.com/docs/components/choropleth-chart) | [/charts/choropleth-chart](https://ui.bklit.com/charts/choropleth-chart) |
81
82## Workflow
83
841. Run `npx shadcn@latest info --json` — verify `@bklit` registry and aliases.
852. Pick a chart from the catalog (or ask the user what story the data tells).
863. Open the doc URL for data shape and props.
874. If not installed: `npx shadcn@latest add @bklit/<slug>`.
885. Compose with grid, series, axes, tooltip — apply theming tokens.
896. Point the user to the gallery or Studio URL for variant inspiration.
90
91## Quick Reference
92
93```bash
94# Project info
95npx shadcn@latest info --json
96
97# Add a chart
98npx shadcn@latest add @bklit/line-chart
99
100# Search registries (if configured)
101npx shadcn@latest search @bklit
102```
103
104```tsx
105import { LineChart, Line, Grid, XAxis, ChartTooltip, chartCssVars } from "@bklitui/ui/charts";
106
107<LineChart data={data} xDataKey="date">
108 <Grid horizontal />
109 <Line dataKey="users" stroke={chartCssVars.linePrimary} />
110 <XAxis />
111 <ChartTooltip />
112</LineChart>
113```
114
115## Utility docs
116
117- Theming: https://ui.bklit.com/docs/theming
118- Grid: https://ui.bklit.com/docs/utility/grid
119- Legend: https://ui.bklit.com/docs/utility/legend
120- Tooltip: https://ui.bklit.com/docs/utility/tooltip
121- Custom indicator: https://ui.bklit.com/docs/utility/custom-indicator
122- useChart: https://ui.bklit.com/docs/utility/use-chart
123
124## Detailed References
125
126- [composition.md](./rules/composition.md)
127- [theming.md](./rules/theming.md)
128- [animation.md](./rules/animation.md)
129- [tooltips.md](./rules/tooltips.md)
130- [installation.md](./rules/installation.md)