AsterUIDocsv1.0.2

Docs / Component reference

DonutChart

Show how much each category contributes to a total. The legend connects each slice to a label and percentage.

Donut chart example

Install

sh
npx @fierst/ui@1.0.2 add donut-chart

Registry dependencies: theme.

Exports from ./ui/donut-chart: DonutSlice, DonutChart.

Download the registry source for donut-chart 1.0.2.

API contracts

ts
export interface DonutSlice {
  label: string;
  value: number;
  color?: string;
}

export function DonutChart({
  data,
  size = 136,
  strokeWidth = 18,
  centerLabel = 'Total',
  class: extraClass,
}: {
  data: readonly DonutSlice[];
  size?: number;
  strokeWidth?: number;
  centerLabel?: string;
  class?: string;
})