Skip to main content
Import from the heavy-dependency adapter subpath (never the base ui barrel):
ChartContainer owns sizing (16:9 by default; size it with CSS), injects one --color-<key> custom property per config entry for the active theme, and restates the Recharts chrome in smithers tokens: hairline grid and axes, muted tick text. Colors react to the data-theme stamp and the OS scheme.

Series colors

chartConfig(series) assigns the fixed categorical palette slots in order. The palette is CVD-validated against both smithers surfaces; the slot order is the safety mechanism, so never reorder, cycle, or invent hues. Past eight series, fold the tail into “Other” or facet into small multiples. chartSeriesColor(index, theme) exposes the raw slot values; CHART_SERIES is the full table. Custom entries can pass { color } or { theme: { light, dark } } per key instead. House chart rules the component expects from callers: one axis per chart (never dual-axis), bars at most 24px thick (maxBarSize={24}) with rounded data-ends, 2px lines, and text in text tokens rather than series colors. Keep the tooltip and legend mounted for two or more series: several light-mode slots sit below 3:1 contrast by design, and the tooltip/legend/table are the mandated relief.

Props

Source: packages/ui/src/adapters/chart.tsx Tests: packages/ui/tests/chart.test.tsx