Get License
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.

Pronew

Chart — part of Base UI Pro

Unlock it plus 85 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.

HTML

Line chart

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

HTML

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%)

HTML

Sparkline

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

Active sessions

1,284

+8.2%

HTML

Installation

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

bash

npx base-ui-cli add chart

API Reference

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

typescript (Example)

import { ChartComponent } from '@lussos/base-ui';

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

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

API reference for chart
SelectorPropertyTypeDefaultDescription
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.

Theme Customizer

Customize your UI instantly.

Primary Color

Border Radius

Background

Mode

Copy these styles to paste into your project's global CSS and Tailwind config.