Skip to main content

Pie Chart

A pie/donut chart component built using Recharts v3. Supports donut variant with center labels, slice labels, and customizable styling.

Installation

$ npx shadcn@latest add @orecus/pie-chart
Registry:
@orecus/chart@orecus/color-utils@orecus/chart-utils@orecus/card

Component

Browser Usage

Distribution of visitors by browser

Classic Style (No Glow)

Using colorStyle='default' and glow={false}

Props

PropTypeDefaultDescription
data*{ name: string; value: number }[]The data for the chart - each item becomes a slice
colorsThemeColor[]Colors for each slice
variant'pie' | 'donut''pie'Chart style
innerRadiusnumber | string60Inner radius for donut variant
outerRadiusnumber | string80Outer radius
showLabelsbooleanfalseShow value labels on slices
showDataLabelsbooleanfalseShow value labels on slices (alias for showLabels for cross-chart consistency)
labelType'value' | 'percent' | 'name''value'Label content type
paddingAnglenumber0Gap between slices in degrees
centerLabel{ value: string | number; label?: string }Center label for donut charts
showLegendbooleantrueShow chart legend
cardPropsCardPropsProps to pass to the underlying Card component
tooltipSortByValuebooleanfalseSort tooltip items by value (descending)
legendIndicator'square' | 'circle' | 'line''square'Shape of legend indicators
legendShowValuesbooleanfalseShow values in legend
legendWrapbooleantrueAllow legend items to wrap to multiple lines