Free
Pro

Chart

Native SVG charts for dashboards — bar, line, donut, and compact sparklines. No third-party chart library required. Fully styled for light and dark mode. Lazy-load below the fold with @defer and the @defer cookbook.

Pronew@defer

Chart — part of Base UI Pro

Unlock it plus 90 pro blocks, widgets & layouts — $99 one-time. Lifetime updates, 14-day money-back guarantee.

Unlock Pro

Bar chart

Pass [data] as an array of label / value points. The tallest bar is highlighted automatically.

Line chart

Use fillArea for an area chart and showGrid for horizontal guides.

Donut chart

Segments cycle the semantic palette. Set centerLabel and optional centerValue for the inner caption.

Customers100
  • Starter(24%)
  • Pro(46%)
  • Team(18%)
  • Enterprise(12%)

Sparkline

Minimal inline trend line — ideal inside stat cards or cells.

Active sessions

1,284

+8.2%

Installation

Run the following command to add this component to your project:

bash

npx base-ui-cli add chart

API Reference

For AI agents

Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.

bash

npx -y base-ui-ng-mcp

Base UI provides standalone components. Import the exact elements you want to use into your component.

typescript (Example)

// Install: npx base-ui-cli add chart
// Paths are relative to aliases.components (default: src/app/components)
import { ChartComponent } from './chart/chart.component';

@Component({
  selector: 'app-your-component',
  imports: [
    ChartComponent
  ],
  template: `...`
})
export class YourComponent {}

API for chart — generated from JSDoc in the library source.

API reference for chart
APIMemberTypeDefaultDescription
base-chartclassstring''Extra host classes merged via `cn()`.
base-charttypeChartType'bar'Chart visualization type.
base-chartdataChartDataPoint[][]Series data points.
base-chartcolorChartColor'primary'Default series color when points do not specify their own.
base-chartheightnumberCHART_HEIGHTPlot height in pixels (bar, line, donut). Sparkline uses a fixed compact height.
base-chartshowLabelsbooleantrueShows category labels under bar charts and on the x-axis for line charts.
base-chartshowGridbooleantrueShows horizontal grid lines on line charts.
base-chartshowLegendbooleantrueShows a color legend below donut charts.
base-chartfillAreabooleanfalseFills the area under a line chart.
base-chartcenterLabelstring''Center caption on donut charts (e.g. "Total").
base-chartcenterValuestring''Center value on donut charts. Defaults to the sum of segment values.
base-chartariaLabelunknown'Chart'Accessible name announced to assistive tech.