Chart: Donut
Each slice takes its color from fill in the data. nameKey on the tooltip and legend looks up the label for each slice in the config.
This adds the example as components/examples/chart/pie.tsx, together with the Chart component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/chart-pie.jsonTo add only the component, follow the Chart installation.
Props in this example
The Chart props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
configLabels, icons and colors for each data key. | ChartConfig | – |
| Prop | Type | Default |
|---|---|---|
contentUsually <ChartTooltipContent />. | ReactElement | (props) => ReactNode | – |
| Prop | Type | Default |
|---|---|---|
contentUsually <ChartLegendContent />. | ReactElement | (props) => ReactNode | – |
Every prop is in the Chart API reference.
- Bar chart
- Line chart
- Stacked bars
- Horizontal bars
- Radar
- Tooltip
- Formatting values
- Icons
- Light and dark colors
- Negative values
- Long labels
- Right to left
See them all, with keyboard support and accessibility notes, on the Chart page.
- AvatarUser photos with an initials fallback, status badges and stacked groups that collapse into a count.
- BadgeStatus labels with colored dots, removable tags that slide closed and counts that roll to their new value.
- CardA surface for grouping content, with three variants, edge-to-edge media, concentric radii and whole-card links.
- Data tableA table for real data, with sorting, search, row selection, pinned columns, a sticky header and pagination.
- ItemA row of media, text and actions for lists, settings and pickers, with a grouped surface and a hover highlight that glides between rows.
- KbdKey caps for shortcuts that show the right symbols on every platform, read them out properly and press down with the real keys.