Bklit UI vs Chart.js
Chart.js is a popular canvas charting library, used in React through the `react-chartjs-2` wrapper. You describe a chart with a configuration object and it draws pixels to a canvas. Bklit UI is built for React from the start: charts are components, rendered as SVG and styled with your Tailwind theme.
At a glance
How Bklit UI and Chart.js differ, feature by feature.
| Feature | Bklit UI | Chart.js |
|---|---|---|
| How you install it | shadcn CLI copies the source into your project | npm packages (chart.js and react-chartjs-2) |
| Rendering | SVG: each mark is a DOM element you can style and inspect | Canvas: one bitmap per chart |
| API | React components you compose | A config object (data and options) passed to a wrapper |
| Styling | Tailwind CSS and CSS variables, light and dark mode | JavaScript options; CSS can't reach the drawing |
| Custom tooltips and overlays | Any React element | Plugins and external tooltip callbacks |
| Very large datasets | Line and area charts downsample to about 1.5 points per pixel | Canvas copes well with many points; has a decimation plugin |
| React Native | Yes: 12 chart types for Expo (beta) | No |
| License | MIT | MIT |
Which should you choose?
Both are good libraries. Pick the one that fits how you build.
Choose Bklit UI if
- You want charts that are React components, not configuration objects.
- You style your app with Tailwind or CSS variables and want charts to follow your theme and dark mode.
- You want custom tooltips, markers and overlays written as ordinary JSX.
Choose Chart.js if
- You also need charts outside React, in plain JavaScript or another framework.
- You draw tens of thousands of points in many charts at once and want canvas rendering.
- You depend on a Chart.js plugin with no Bklit equivalent.
The same chart in both
A two-series line chart with a grid, an x axis and a tooltip.
import { ChartTooltip, Grid, Line, LineChart, XAxis,} from "@bklitui/ui/charts";const data = [ { date: new Date("2026-01-01"), revenue: 12000, costs: 8500 }, { date: new Date("2026-01-02"), revenue: 13500, costs: 9200 }, { date: new Date("2026-01-03"), revenue: 11000, costs: 7800 },];export function RevenueChart() { return ( <LineChart data={data}> <Grid horizontal /> <Line dataKey="revenue" /> <Line dataKey="costs" stroke="var(--chart-line-secondary)" /> <XAxis /> <ChartTooltip /> </LineChart> );}import { CategoryScale, Chart as ChartJS, LinearScale, LineElement, PointElement, Tooltip,} from "chart.js";import { Line } from "react-chartjs-2";ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Tooltip);const data = { labels: ["Jan 1", "Jan 2", "Jan 3"], datasets: [ { label: "Revenue", data: [12000, 13500, 11000], borderColor: "#2563eb" }, { label: "Costs", data: [8500, 9200, 7800], borderColor: "#a855f7" }, ],};export function RevenueChart() { return <Line data={data} options={{ responsive: true }} />;}Questions
- Should I use SVG or canvas charts in React?
- SVG suits most dashboards: every mark is a real element, so it scales crisply, can be styled with CSS and works with React's own tooling. Canvas pulls ahead when a page draws tens of thousands of points at once. Bklit line and area charts downsample large series, so SVG stays fast for typical time-series data.
- How do I move from react-chartjs-2 to Bklit UI?
- Turn each
datasetsentry into a component (<Line dataKey="revenue" />) and reshape your data from parallel arrays into one object per point. The Chart.js migration guide walks through it.
Try Bklit UI in your app
Add a chart with one command: npx shadcn@latest add @bklit/line-chart