К основному содержанию
скилл CX Codex

bklit-ui — скилл для Claude Code: что делает и как установить

Скилл подключает графики Bklit UI в React и Next.js: ставит компоненты из реестра @bklit и показывает, как собрать серию с осями и тултипом.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add bklit/bklit-ui --skill bklit-ui -a claude-code
Открыть на GitHub

Что делает bklit-ui

Скилл ставит в проект компоненты Bklit UI: графики на visx и motion, которые раздают через реестр @bklit для shadcn. shadcn add копирует исходники в ваш репозиторий, поэтому дальше props и поведение смотрите в собственных файлах, а не в чужой библиотеке.

Перед первым графиком скилл проверяет components.json и вызывает npx shadcn@latest init, если файла нет. Записи @bklit в registries может не быть, тогда её добавляют вручную. Импортировать надо из components/charts/ по алиасу проекта: путь @bklitui/ui/charts не сработает, это приватный пакет монорепозитория. Спарклайны устроены иначе — LineSparkline, AreaSparkline, BarSparkline это одиночные элементы с data и dataKey, высота по умолчанию 32, тултипа нет, наведение берут через useSparklineHover.

Темы держатся на токенах --chart-1…--chart-5 и chartCssVars. Реестр добавляет недостающие переменные и не перетирает те, что уже есть в приложении, поэтому светлую и тёмную палитру можно не ломать.

Какие задачи решает

  • поставить линейный график с сеткой и тултипом
  • собрать спарклайн для KPI-карточки без осей
  • синхронизировать перекрестия на нескольких спарклайнах
  • перевести цвета серий на токены --chart-*
  • добавить свечи OHLC на страницу котировок

Примеры запросов агенту

  • Поставь @bklit/line-chart и @bklit/grid на страницу аналитики, данные из metrics.ts.
  • Сделай KPI-карточку с AreaSparkline из @bklit/sparkline, высоту не задавай.
  • Добавь ChartTooltip и перекрестие к свечному графику @bklit/candlestick-chart.

Как установить bklit-ui

1Через Skills CLI (Vercel)

npx skills add bklit/bklit-ui --skill bklit-ui -a claude-code

2Вручную: положить файлы

~/.claude/skills/bklit-ui/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/bklit-ui/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Похожие

syncfusion-react-3d-chart Syncfusion Inc Скилл помогает агенту собрать объёмные столбчатые и линейчатые диаграммы Syncfusion в React-проекте. Пригодится, когда нужен график с осями, легендой и экспортом. CX Codex +1 656установок clerk-custom-ui clerk Скилл по Clerk: агент собирает свою форму входа на хуках useSignIn и useSignUp либо перекрашивает готовые компоненты под бренд. CX Codex +1 55 200установок aceternity-ui Claude Skills Maintainers Скилл подключает к агенту библиотеку Aceternity UI: больше 100 анимированных компонентов React для Next.js с Tailwind. Пригодится, когда нужен hero-блок, параллакс или 3D-эффект. CX Codex +1 1 500установок magic-ui magicuidesign Скилл magic-ui учит Claude Code работать с компонентами Magic UI в React и Next.js: выбирать анимации, ставить через shadcn-реестр и проверять доступность. CX Codex +1 1 200установок shadcn-layouts jwynia Помогает агенту собрать раскладку на shadcn и Tailwind так, чтобы она заработала с первого раза, и разобраться с высотой, скроллом и flex/grid. CX Codex +1 457установок data-viz-2025 curiositech Скилл для React, Next.js и TypeScript: помогает строить интерактивные графики, дашборды и визуализации на Tailwind CSS. CX Codex +1 304установок

Рядом в теме «Фронтенд и UI»

Всё по теме «Фронтенд и UI» →

Вопросы о bklit-ui

Как установить bklit-ui в Claude Code?

Выполните npx skills add bklit/bklit-ui --skill bklit-ui -a claude-code. Файл скилла появится по пути ~/.claude/skills/bklit-ui/SKILL.md.

Что делает bklit-ui?

Помогает выбрать и поставить нужный компонент Bklit UI под линию, бары, свечи или спарклайн, собрать его с осями и тултипом и перекрасить под тему приложения.

Что нужно, чтобы скилл заработал?

Файл components.json в проекте; если его нет, скилл запустит npx shadcn@latest init. Ещё нужна запись @bklit в registries.

Исходный текст

SKILL.md · MIT
---
name: bklit-ui
description: >
  Install, compose, theme, and animate Bklit UI charts (the @bklit shadcn
  registry) in a React / Next.js app. Use when the user wants a chart, graph,
  or data visualization: line, area, bar, live/streaming line, composed,
  scatter, candlestick/OHLC, pie, ring/donut, radar, gauge, heatmap, funnel,
  sankey, sunburst, or choropleth/world map; a sparkline or tiny inline
  chart (LineSparkline, AreaSparkline, BarSparkline, useSparklineHover) for
  tables, KPI cards, or dense dashboards; a dashboard, analytics page, KPI or
  stat card; chart tooltips, crosshairs, legends, markers,
  reference bands, projections, trend lines, axes, or grids; or when code imports from
  components/charts/* or mentions @bklit/* or bklit.com. For styling vocabulary
  (patterns, squircle/rounded/3D bars, fades, loading looks, matching the app
  theme) also use bklit-ui-design. For moving from Recharts, shadcn
  ChartContainer, or TanStack Charts to Bklit, use bklit-ui-migrate.
allowed-tools: Bash(npx shadcn@latest *), Bash(pnpm dlx shadcn@latest *), Bash(bunx --bun shadcn@latest *), Bash(yarn dlx shadcn@latest *)
---

# Bklit UI

Composable React chart components (visx + motion) distributed through the `@bklit` shadcn registry. `shadcn add` copies the **source** into the user's project — the user owns that code, and it is the source of truth for props.

> Run the shadcn CLI with the project's package runner: `npx shadcn@latest`, `pnpm dlx shadcn@latest`, `bunx --bun shadcn@latest`, or `yarn dlx shadcn@latest`.

## Current Project Context

```json
!`npx shadcn@latest info --json`
```

If the block above is empty or still shows the command (agents that do not expand `!` injections), run `npx shadcn@latest info --json` yourself before writing code. Use it for framework, aliases (`@/…`), Tailwind version, and installed components.

- **No `components.json`?** Run `npx shadcn@latest init` first.
- **No `@bklit` in `registries`?** Add `"@bklit": "https://ui.bklit.com/r/{name}.json"` (see [installation.md](./rules/installation.md)), or install by URL: `npx shadcn@latest add https://ui.bklit.com/r/line-chart.json`.

## Principles

1. **Install before inventing.** `npx shadcn@latest add @bklit/<item>` — never hand-roll SVG charts or reimplement a registry piece.
2. **Import from the installed files, never from `@bklitui/ui/charts`.** That is a private monorepo package. Items install to `components/charts/<file>.tsx` (under `src/` when the project uses it); import with the user's alias, e.g. `@/components/charts/line-chart`. See [Imports](#imports).
3. **Read the installed source.** After `add`, open the files in `components/charts/` to confirm prop names and defaults before using them.
4. **Compose, don't flatten.** Root chart → `Grid`/`Background` → series → axes → overlays → `ChartTooltip`. See [composition.md](./rules/composition.md).
5. **Theme with tokens.** `--chart-*` variables and `chartCssVars`, not one-off hex values. See [theming.md](./rules/theming.md).

## Imports

There is no barrel for component items — import each export from the file that defines it (paths relative to the `components/charts/` alias):

| Import from | Exports |
|---|---|
| `line-chart` | `LineChart`, `Line` |
| `area-chart` | `AreaChart`, `Area` |
| `bar-chart` / `bar` / `bar-x-axis` / `bar-y-axis` | `BarChart` / `Bar` / `BarXAxis` / `BarYAxis` |
| `sparkline` | `LineSparkline`, `AreaSparkline`, `BarSparkline`, `useSparklineHover` |
| `composed-chart` / `series-bar` | `ComposedChart` / `SeriesBar` (+ `Line`, `Area` from their charts) |
| `scatter-chart` | `ScatterChart`, `Scatter` |
| `candlestick-chart` / `candlestick` | `CandlestickChart` / `Candlestick` |
| `live-line-chart` / `live-line` / `live-x-axis` / `live-y-axis` | `LiveLineChart` / `LiveLine` / `LiveXAxis` / `LiveYAxis` |
| `pie-chart` / `pie-slice` / `pie-center` | `PieChart` / `PieSlice` / `PieCenter` |
| `ring-chart` / `ring` / `ring-center` | `RingChart` / `Ring` / `RingCenter` |
| `radar-chart`, `radar-grid`, `radar-axis`, `radar-labels`, `radar-area` | one component each |
| `gauge` | `Gauge` (installed by `@bklit/gauge-chart`) |
| `funnel-chart` | `FunnelChart` |
| `sunburst-chart`, `sunburst-segment`, `sunburst-center`, `sunburst` (`buildArcs`) … | sunburst parts |
| `heatmap` · `choropleth` · `sankey` | folder `index.ts` re-exports every part |
| `grid` · `x-axis` · `y-axis` · `background` · `reference-area` · `projection-line` · `trend-line` | `Grid` · `XAxis` · `YAxis` · `Background` · `ReferenceArea` · `ProjectionLine` · `TrendLine` |
| `band` · `bollinger` | `Band` · `withBollingerBands` (installed by `@bklit/line-chart`, also `@bklit/band`) |
| `weekends` · `deadline` | `Weekends` · `Deadline` (date-axis shading and due-date marker) |
| `tooltip` · `legend` · `markers` · `patterns` | folder `index.ts` (`ChartTooltip`, `Legend*`, `ChartMarkers`, `Pattern*`) |
| `chart-context` | `chartCssVars`, `useChart`, `TooltipData` |

```tsx
import { LineChart, Line } from "@/components/charts/line-chart";
import { Grid } from "@/components/charts/grid";
import { XAxis } from "@/components/charts/x-axis";
import { ChartTooltip } from "@/components/charts/tooltip";
import { chartCssVars } from "@/components/charts/chart-context";
```

## Critical Rules

### Composition → [composition.md](./rules/composition.md)
- Series, axes, overlays, and `ChartTooltip` are **children of the root chart** — they read chart context.
- **One root per chart.** Mixed bars + lines on dates → `ComposedChart` with `SeriesBar` (not `Bar`).
- **`Grid` (or `Background`) first** so series paint above it.
- Live charts use **`LiveLine`**, `LiveXAxis`, `LiveYAxis` — not `Line`/`XAxis`.
- `BarChart` uses **`BarXAxis`** / `BarYAxis` (band scale), not `XAxis`.

### Theming → [theming.md](./rules/theming.md)
- `--chart-1` … `--chart-5` for series; `chartCssVars.linePrimary` etc. for semantic roles.
- The registry **adds** missing `--chart-*` tokens without overwriting the app's existing ones.
- Override tokens in `:root` / `.dark`; no `dark:` classes on chart SVG.

### Tooltips → [tooltips.md](./rules/tooltips.md)
- `ChartTooltip` `content` receives `({ point, index })`; `rows` returns `{ color, label, value }[]`.
- `indicatorColor` is a string or `(point) => string`.
- Custom crosshairs/indicators use `useChart()` — never global mouse listeners.

### Sparklines (`@bklit/sparkline`)
- `LineSparkline` / `AreaSparkline` / `BarSparkline` are **single elements** — `data` + `dataKey`, no children. Don't build sparklines from `LineChart` with hidden axes.
- Omit `width` to fill the parent; `height` defaults to 32. `color`, `curve` (`"monotone"` default), `strokeWidth`, `endDot`; area `fill="gradient" | "solid"` + `fillOpacity`; bar `barGap`, `barRadius`.
- **No tooltip by design.** `const hover = useSparklineHover<Row>()`, spread `hover.sparklineProps` (on several sparklines to sync crosshairs), render `hover.datum ?? latest` yourself. `crosshair` (`"dashed"` default, `"solid"`, `"gradient"`, `false`), `dot`, `interactive={false}`. Hover fades the series and re-strokes the hovered segment like the main charts (`showHighlight`, `inactiveOpacity` 0.5; bars fade unfocused bars to 0.4). Crosshair and dot spring between points (`hoverTransition={false}` to snap, `springConfig` to tune), and new `data` morphs in over `dataTransitionDuration` (500ms; `0` snaps). Reduced motion snaps both.
- Enter animation is on (`animate`, 900ms) and falls back to a fade under reduced motion.

### Overlays → [overlays.md](./rules/overlays.md)
- `ChartMarkers` is a **sibling** of `ChartTooltip`; marker hover content goes inside `ChartTooltip` children.
- `ChartBrush` has **no registry item** — don't promise `@bklit/brush`.
- `TrendLine` (`@bklit/trend-line`) fits an existing series' `dataKey`; place it after that series (line, area, bar incl. horizontal, composed).

### Animation and loading → [animation.md](./rules/animation.md), [loading.md](./rules/loading.md)
- Default enter: **1100ms**, ease `cubic-bezier(0.85, 0, 0.15, 1)`; bars stagger across ~40% of that.
- Replay with `revealSignature` or a new `key`.
- `status="loading"` on `LineChart` / `AreaChart` / `BarChart` / `HeatmapChart` — one instance, no component swap.
- Reduced motion is only **partially** handled internally — see animation.md.

### Installation → [installation.md](./rules/installation.md)
- Let `shadcn add` install npm deps and `@bklit/*` registry dependencies; don't pin `@visx/*` by hand.
- Don't install `*-example` items into an existing app — they write `app/page.tsx`.

## Catalog

All items install with `npx shadcn@latest add @bklit/<item>`. For any `<item>`:

- Docs: `https://bklit.com/docs/components/<item>` (add-ons live under `https://bklit.com/docs/utility/…`, e.g. `/tooltip`, `/legend`, `/axis/y-axis`)
- Gallery: `https://bklit.com/charts/<item>` · Studio (tune props, copy code): `https://bklit.com/studio?chart=<item>`
- Registry JSON: `https://ui.bklit.com/r/<item>.json`

### Charts

| Item | Use when |
|---|---|
| `line-chart` | Time series, multi-line trends, markers, dashed tails |
| `area-chart` | Trends with filled regions, gradient/pattern fills |
| `sparkline` | Tiny inline line / area / bar trends for table cells, KPI and stat cards, dense grids — no axes, grid or tooltip; read the hovered value with `useSparklineHover` |
| `bar-chart` | Category comparisons; grouped, stacked, horizontal, square-column bars |
| `composed-chart` | Bars + lines/areas on one date axis, dual Y axes |
| `live-line-chart` | Streaming / real-time values (`{ time: unixSeconds, value }`) |
| `scatter-chart` | Point clouds over time, multiple series |
| `candlestick-chart` | OHLC financial data |
| `profit-loss-line` | One series crossing zero, colored by sign (studio slug too) |
| `pie-chart` | Part-to-whole slices, optional center stat |
| `ring-chart` | Concentric progress rings / donut KPIs |
| `radar-chart` | Multi-metric comparison across entities |
| `gauge-chart` | Single value 0–100, arc or linear notched track |
| `heatmap-chart` | Calendar / contribution grids, binned intensity |
| `funnel-chart` | Stage-to-stage conversion |
| `sankey-chart` | Flows between nodes |
| `sunburst-chart` | Hierarchical part-to-whole with drill-down |
| `choropleth-chart` | Geo regions colored by value (world/country maps) |

### Add-ons (most install automatically as dependencies)

`grid`, `x-axis`, `y-axis` (not pulled in by line/area — add it for a value axis), `chart-tooltip`, `legend`, `markers`, `background`, `patterns`, `reference-area`, `projection-line`, `trend-line` (least-squares trend overlay for line/area/bar/composed), `band` (range / Bollinger band on `LineChart`; already in `line-chart`), `bar-depth` (3D/extruded bars on `BarChart`), `chart-stat-flow` (animated stat number used by pie/ring/gauge centers and stat cards). Internal plumbing items (`chart-context`, `chart-animation`, `chart-series`, `chart-utils`, `chart-parent-size`, `utils`, `shimmering-text`) come in automatically.

**Brush:** `ChartBrush` / `ChartBrushLayout` (docs: `/docs/utility/brush`) are **not** in any registry item today. If the user needs brush zoom, say so and point to the docs/source rather than inventing an install command.

### Blocks (stat cards; browse at https://bklit.com/blocks)

| Item | What |
|---|---|
| `stat-card-area-01` | Revenue card: `AreaSparkline` (gradient), hover-to-read value, NumberFlow, trend badge |
| `stat-card-line-01` | Sessions card: `LineSparkline` with overlaid value, hover-to-read, trend badge |
| `stat-card-choropleth-01` | Visitors card: choropleth mini map, trend badge |

The area and line cards are built on `@bklit/sparkline` (installed as a dependency) and use `useSparklineHover` to swap the headline number for the hovered value. For a sparkline in a table row or a custom card, compose `@bklit/sparkline` directly instead of installing a block.

Blocks need shadcn `card` + `badge`, write sample data under `data/`, and import from a `@/components/charts` **barrel** (`components/charts/index.ts`) that they create. Installing a second block overwrites that barrel and shared files (`stat-card-chart.tsx`, `stat-card-sparkline-hover.ts`, `trend-badge.tsx`) — merge them by hand.

## Workflow

1. Get project context (injection above or `npx shadcn@latest info --json`); confirm `@bklit` is configured.
2. Pick the item from the catalog by the story the data tells; ask if unclear.
3. Install: `npx shadcn@latest add @bklit/<item>` (plus `@bklit/y-axis`, `@bklit/legend`, etc. if needed).
4. **Read the installed source** in `components/charts/` (the files the CLI just wrote) — confirm exports, prop names, defaults, and data shape. Prefer it over memory or docs if they disagree.
5. Compose root → grid → series → axes → overlays → tooltip; import from the installed paths with the project alias.
6. Theme with tokens; check light and dark.
7. Point the user to the gallery / Studio URL for variants.

## Quick Reference

```bash
npx shadcn@latest info --json
npx shadcn@latest add @bklit/line-chart @bklit/y-axis
npx shadcn@latest view @bklit/line-chart     # inspect files before installing
```

```tsx
"use client";

import { ChartTooltip } from "@/components/charts/tooltip";
import { Grid } from "@/components/charts/grid";
import { Line, LineChart } from "@/components/charts/line-chart";
import { XAxis } from "@/components/charts/x-axis";

const data = [
  { date: new Date("2025-01-01"), users: 1200, sessions: 1800 },
  { date: new Date("2025-02-01"), users: 1350, sessions: 1950 },
];

export function UsersChart() {
  return (
    <LineChart data={data}>
      <Grid horizontal />
      <Line dataKey="users" stroke="var(--chart-1)" />
      <Line dataKey="sessions" stroke="var(--chart-2)" />
      <XAxis />
      <ChartTooltip />
    </LineChart>
  );
}
```

## Related skills

- **[bklit-ui-design](../bklit-ui-design/SKILL.md)** — design vocabulary and recipes: patterns and textures, squircle / rounded / 3D bars, edge fades, gradients, loading looks, and matching charts to the app's theme. Use it when the request is about how a chart *looks*.
- **[bklit-ui-migrate](../bklit-ui-migrate/SKILL.md)** — move Recharts, shadcn `ChartContainer` / `ChartConfig`, or TanStack Charts (`@tanstack/charts`) charts to Bklit equivalents, including tiny charts → sparklines.

Install all three with `npx skills add bklit/bklit-ui`.

## References

- [composition.md](./rules/composition.md) — structure, data shapes, multi-series
- [theming.md](./rules/theming.md) — tokens, `chartCssVars`, dark mode
- [tooltips.md](./rules/tooltips.md) — `ChartTooltip` props, custom content, `useChart`
- [overlays.md](./rules/overlays.md) — legend, markers, reference area, projection, trend line, background, brush
- [animation.md](./rules/animation.md) — enter timing, replay, live charts, reduced motion
- [loading.md](./rules/loading.md) — `status`, skeletons, loading labels
- [installation.md](./rules/installation.md) — registry setup, file layout, dependencies

© bklit · MIT · bklit/bklit-ui

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой