GitHub

Chart

CSS-only container for chart libraries (Chart.js, D3, matplotlib, etc.) with theming, legend, tooltip, and glass support. Provides 10 color tokens, fixed height sizes, and automatic dark mode adaptation.

Basic Container

chart-sm (200px)
chart-md (300px)
chart-lg (400px)
chart-xl (500px)

With Header

Monthly Revenue

Jan - Jun 2026

[Chart.js canvas here]

Legend

Sales by Category

Current quarter

[Chart area]
Electronics Clothing Food Books Other

Tooltip

January
$12,450
Revenue
+12.5% vs last month

SVG Support

Jan Feb Mar Apr May

Glass Variant

Performance

Last 7 days

Visits Conversions
[Chart canvas here]

Color Tokens

10 chart color tokens adapt to your theme and dark mode:

--chart-1
--chart-2
--chart-3
--chart-4
--chart-5
--chart-6
--chart-7
--chart-8
--chart-9
--chart-10

Full Example (Header + Chart Area + Legend)

Quarterly Revenue

Q1 - Q4 2025

Q1 Q2 Q3 Q4
Revenue Target

Reference

Class Description
.chartBase chart container with theme variables and canvas support
.chart-borderedAdds 1px border (base-300)
.chart-paddedAdds padding (1rem, 0.5rem on mobile)
.chart-smFixed height: 200px
.chart-mdFixed height: 300px
.chart-lgFixed height: 400px
.chart-xlFixed height: 500px
.chart-headerFlex row for title and actions above the chart
.chart-titleSemibold title text
.chart-subtitleSecondary description text (smaller, muted)
.chart-actionsAction buttons container in header (right side)
.chart-legendFlex-wrap legend container with gap
.chart-legend-itemIndividual legend entry (flex row with dot + label)
.chart-legend-dot10px colored circle (defaults to --chart-1)
.chart-tooltipFixed-position tooltip (hidden by default, animated)
.chart-tooltip-visibleShows the tooltip (opacity: 1, translateY: 0)
.chart-tooltip-titleBold title inside tooltip
.chart-tooltip-valueSmaller value text inside tooltip
.chart-svgSVG adapter: auto-themes text, backgrounds, and matplotlib colors
.chart.glassGlassmorphism variant (frosted background)

CSS Variables

Variable Default Description
--chart-1primarySeries color 1
--chart-2infoSeries color 2
--chart-3successSeries color 3
--chart-4warningSeries color 4
--chart-5errorSeries color 5
--chart-6secondarySeries color 6
--chart-7accentSeries color 7
--chart-8oklch(0.70 0.15 200)Series color 8
--chart-9oklch(0.60 0.20 300)Series color 9
--chart-10oklch(0.65 0.18 340)Series color 10
--chart-gridbase-300Grid line color
--chart-axisbase-content 40%Axis line and label color
--chart-textbase-contentPrimary text color
--chart-text-secondarybase-content 60%Secondary/muted text color