Introduction to Bklit UI
mainshadcn/ui and specifically focuses on simplifying the creation of charts and data visualizations.repository·main·Indexed 23 days ago
https://github.com/bklit/bklit-uiA collection of open-source, customizable, and extendable React chart components designed for the shadcn registry. It includes a wide range of supported charts such as Area, Bar, Candlestick, Choropleth, Composed, Funnel, Gauge, Line, Pie, Radar, Ring, Scatter, and Sankey. The ecosystem features Bklit Studio, a proprietary interactive playground for real-time chart customization, code generation, and registry exports, as well as a dedicated set of editor UI components and a central icon system.
shadcn/ui and specifically focuses on simplifying the creation of charts and data visualizations.The bklit-ui skill equips your AI assistant with several key domains of knowledge:
Instructions on how to configure the @bklit namespace and install specific charts using the shadcn CLI.
LineChart → Grid → Line → XAxis → ChartTooltip).chartCssVars for type-safe theming and applying series palette tokens (--chart-1 through --chart-5) or sequential scale tokens (--chart-scale-01 through --chart-scale-05) for heatmaps and choropleths.revealSignature.useChart hook for custom indicators.indicatorColor for candlestick charts.Access to a decision guide for all 15 supported chart types: area, bar, line, live line, composed, scatter, candlestick, pie, ring, radar, gauge, heatmap, funnel, sankey, and choropleth.
Avoid hardcoding colors. Bklit UI uses a token-based theming system to ensure consistency and support for light/dark modes.
Best Practices:
chartCssVars: Import chartCssVars from @bklitui/ui/charts to access theme tokens instead of writing raw var(--chart-...) strings.--chart-1 through --chart-5 variables to define colors for different data series.bg-popover text-popover-foreground to prevent visibility issues (like white-on-white) in light mode.The Background component provides a pattern fill for the plot area of a chart, serving as an alternative to Grid when you want texture instead of reference lines.
Key behaviors:
LineChart, AreaChart, BarChart, ScatterChart, CandlestickChart, ComposedChart, LiveLineChart).@visx/pattern under the hood.import { LineChart, Line, Background, ChartTooltip, XAxis } from "@bklitui/ui/charts";
<LineChart data={data}>
<Background pattern="diagonal" />
<Line dataKey="value" />
<XAxis />
<ChartTooltip />
</LineChart>ChartLoadingLabel component provided by @bklitui/ui. This component internally utilizes ShimmeringText to handle loading labels.<Grid /> component, you can use the Background utility to apply pattern fills behind the candles.Bklit UI charts follow a specific composition pattern. Instead of a single monolithic component, you build charts by nesting specialized components inside a root chart component.
Composition Rules:
LineChart, BarChart, AreaChart). Use ComposedChart if you need to mix different series types (like bars and lines) on the same axes.<Grid /> component before your series components (like <Line /> or <Bar />) so that data renders on top of the grid lines.<ChartTooltip /> as a child of the root chart to enable crosshair and hover functionality.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>The Legend component uses a composable API. Instead of passing a configuration object for the layout, you define a single layout using child components (like LegendItemComponent, LegendMarker, etc.) inside the Legend root. The Legend component then automatically maps this layout to every item in your items data array.
This allows for highly flexible layouts, such as simple horizontal rows, grid-based layouts with progress bars, or complex custom arrangements, all while maintaining a single source of truth for the data.
const data = [
{ label: "Organic", value: 4250, maxValue: 5000, color: "#0ea5e9" },
{ label: "Paid", value: 3120, maxValue: 5000, color: "#a855f7" },
];
<Legend items={data} title="Traffic Sources">
<LegendItemComponent>
<LegendMarker />
<LegendLabel />
<LegendValue />
</LegendItemComponent>
</Legend>The Radar Chart uses a composable API where a root RadarChart container provides context to specialized child components. You define your metrics and data, then combine components to build the visual layers.
Typical composition order:
RadarChart: The root container.RadarGrid: Renders the circular grid lines.RadarAxis: Renders axis lines from the center to each metric.RadarLabels: Renders metric labels around the perimeter.RadarArea: Renders individual data polygons (one per data series).import { RadarChart, RadarGrid, RadarAxis, RadarLabels, RadarArea } from "@bklitui/ui/charts";
const metrics = [
{ key: "speed", label: "Speed" },
{ key: "power", label: "Power" },
{ key: "technique", label: "Technique" },
];
const data = [
{ label: "Player A", color: "#3b82f6", values: { speed: 85, power: 70, technique: 90 } },
{ label: "Player B", color: "#f59e0b", values: { speed: 65, power: 95, technique: 60 } },
];
export default function PerformanceRadar() {
return (
<RadarChart data={data} metrics={metrics} size={400}>
<RadarGrid />
<RadarAxis />
<RadarLabels />
{data.map((item, index) => (
<RadarArea key={item.label} index={index} />
))}
</RadarChart>
);
}For advanced custom crosshairs or markers that exist outside the standard ChartTooltip configuration, do not attempt to track mouse position manually via window event listeners. Instead, use the useChart hook from @bklitui/ui/charts to access the tooltipData provided by the chart context.
import { useChart } from "@bklitui/ui/charts";
function CustomIndicator() {
const { tooltipData } = useChart();
// render from tooltipData
}The Axis components provide date labels (X Axis) and value labels (Y Axis) for line and area charts.
To use them correctly, you must follow these requirements:
LineChart or AreaChart component.Studio UI is the design system specifically for the chart editor (sidebars, property rows, motion controls, and pickers). It is distinct from the chart rendering primitives, which reside in @bklitui/ui.
Key architectural boundaries:
@bklitui/studio: Contains editor-only UI components, including property widgets and the editor shell.@bklitui/ui: Contains the actual chart rendering components.@bklitui/icons: The central icon system used across the ecosystem.Note: Studio UI is intended for local development/editor use and is not a deployed public site.