On this page
Chart
Displays responsive TanStack charts with themed colors, tooltips, and legends.
Overview
Copy the source into your project. Import the parts that you need. Styles use local StyleX declarations and shared theme tokens. You can change the source without a wrapper or replacement package.
Preview
Area, bar, line, pie, radar, and radial charts
| Month | Device | Visits |
|---|---|---|
| Jan | Desktop | 186 |
| Jan | Mobile | 80 |
| Feb | Desktop | 205 |
| Feb | Mobile | 120 |
| Mar | Desktop | 165 |
| Mar | Mobile | 130 |
| Apr | Desktop | 230 |
| Apr | Mobile | 160 |
| May | Desktop | 240 |
| May | Mobile | 180 |
| Jun | Desktop | 280 |
| Jun | Mobile | 210 |
Area examples
Area usage
Use one row for each month and series. Stack the series to show their combined total. Group focus shows all values for the same month.
The chart tokens keep the same series colors in light and dark themes. Surfaces, labels, and grid lines follow the theme. Give each chart an accessible name and check its keyboard interaction.
Use pointer movement or arrow keys to inspect points. Press Escape to dismiss the tooltip. Keep persistent selection in caller state.
"use client"
import { Chart, ChartContainer, ChartLegendContent, ChartTooltipContent } from "@/components/ui/chart"
import { tokens } from "@/styles/tokens.stylex"
import { areaY, defineChart, stack } from "@tanstack/charts"Bar examples
Select a bar
Bar usage
Use one row for each category and series. A band scale places categories on the horizontal axis. Group bars to compare series side by side.
The chart tokens keep the same series colors in light and dark themes. Surfaces, labels, and grid lines follow the theme. Give each chart an accessible name and check its keyboard interaction.
Use pointer movement or arrow keys to inspect points. Press Escape to dismiss the tooltip. Keep persistent selection in caller state.
"use client"
import { Chart, ChartContainer, ChartLegendContent, ChartTooltipContent } from "@/components/ui/chart"
import { tokens } from "@/styles/tokens.stylex"
import { barY, defineChart, group } from "@tanstack/charts"Line examples
Line usage
Use one row for each month and series. The z channel keeps each series in its own line. Keep rows in chronological order.
The chart tokens keep the same series colors in light and dark themes. Surfaces, labels, and grid lines follow the theme. Give each chart an accessible name and check its keyboard interaction.
Use pointer movement or arrow keys to inspect points. Press Escape to dismiss the tooltip. Keep persistent selection in caller state.
"use client"
import { Chart, ChartContainer, ChartLegendContent, ChartTooltipContent } from "@/components/ui/chart"
import { tokens } from "@/styles/tokens.stylex"
import { defineChart, lineY } from "@tanstack/charts"Pie examples
Compare parts of a whole with pie and donut charts.
Pie usage
Use one nonnegative value for each part of the whole. Pie computes slice angles; radialArc draws a donut. The legend names each source without relying on color.
The chart tokens keep the same series colors in light and dark themes. Surfaces, labels, and grid lines follow the theme. Give each chart an accessible name and check its keyboard interaction.
Use pointer movement or arrow keys to inspect points. Press Escape to dismiss the tooltip. Keep persistent selection in caller state.
"use client"
import type { ChartValue, SceneNode } from "@tanstack/charts"
import type { PolarMark } from "@tanstack/charts/polar"
Radar examples
Compare measures across a shared radial scale.
Radar usage
Use one row for each category and a numeric score on a common scale. A wrapped point scale sets the angles; a linear radius scale sets the values.
The chart tokens keep the same series colors in light and dark themes. Surfaces, labels, and grid lines follow the theme. Give each chart an accessible name and check its keyboard interaction.
Use pointer movement or arrow keys to inspect points. Press Escape to dismiss the tooltip. Keep persistent selection in caller state.
"use client"
import type { ChartValue, SceneNode } from "@tanstack/charts"
import type { PolarMark } from "@tanstack/charts/polar"
Radial examples
Show progress with angle-encoded arcs.
Radial usage
Convert a bounded fraction to an end angle in radians. Draw the progress arc over a full track, and show the value as text. This is angle-based progress, not a radial-radius bar.
The chart tokens keep the same series colors in light and dark themes. Surfaces, labels, and grid lines follow the theme. Give each chart an accessible name and check its keyboard interaction.
Use pointer movement or arrow keys to inspect points. Press Escape to dismiss the tooltip. Keep persistent selection in caller state.
"use client"
import type { ChartValue, SceneNode } from "@tanstack/charts"
import type { PolarMark } from "@tanstack/charts/polar"
Tooltip examples
Use keyboard arrows or the pointer to inspect each chart.
Initial focus lifecycle
Show each chart to inspect its initial focus.
Tooltip usage
Group focus shows the values at one category. The formatter receives the native context as its fourth argument. Use pointer movement or arrow keys to inspect the values.
The chart tokens keep the same series colors in light and dark themes. Surfaces, labels, and grid lines follow the theme. Give each chart an accessible name and check its keyboard interaction.
Use pointer movement or arrow keys to inspect points. Press Escape to dismiss the tooltip. Keep persistent selection in caller state.
"use client"
import { Chart, ChartContainer, ChartTooltipContent } from "@/components/ui/chart"
import { tokens } from "@/styles/tokens.stylex"
import { barY, defineChart, group } from "@tanstack/charts""use client"
import { barY, defineChart } from "@tanstack/charts"
import { scaleBand } from "@tanstack/charts/scales/band"
import { scaleLinear } from "@tanstack/charts/scales/linear"Installation
Run the init command from your project root first. The CLI configures StyleX and installs shared files and dependencies.
bunx --bun @yopem-ui/cli init --provider ark-uibunx --bun @yopem-ui/cli add chartRun from your project root. The CLI installs required components, shared files, and packages. Previews may need additional components. The CLI keeps existing files.
Usage
Displays responsive TanStack charts with themed colors, tooltips, and legends.
Import from the local file installed by the CLI.
Open the preview source for a copyable example.
API reference
The generator reads the component TypeScript source. Only component and Ark UI props appear below. The Required column shows whether you must supply a property. It does not mean you must use the component.