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.
Unlock it plus 85 pro blocks, widgets & layouts — $99 one-time. Lifetime updates, 14-day money-back guarantee.
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.
- 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.
| Selector | Property | Type | Default | Description |
|---|---|---|---|---|
base-chart | class | string | '' | Extra host classes merged via `cn()`. |
base-chart | type | ChartType | 'bar' | Chart visualization type. |
base-chart | data | ChartDataPoint[] | [] | Series data points. |
base-chart | color | ChartColor | 'primary' | Default series color when points do not specify their own. |
base-chart | height | number | CHART_HEIGHT | Plot height in pixels (bar, line, donut). Sparkline uses a fixed compact height. |
base-chart | showLabels | boolean | true | Shows category labels under bar charts and on the x-axis for line charts. |
base-chart | showGrid | boolean | true | Shows horizontal grid lines on line charts. |
base-chart | showLegend | boolean | true | Shows a color legend below donut charts. |
base-chart | fillArea | boolean | false | Fills the area under a line chart. |
base-chart | centerLabel | string | '' | Center caption on donut charts (e.g. "Total"). |
base-chart | centerValue | string | '' | Center value on donut charts. Defaults to the sum of segment values. |
base-chart | ariaLabel | unknown | 'Chart' | Accessible name announced to assistive tech. |
Content