Launch sale — 60% off Pro
Contact
ChartPie

Not affiliated with official shadcn/ui. Visit ui.shadcn.com for official docs.

React A pie chart with a legend

A React pie chart with legend component for category identification separate from the chart using shadcn/ui and Recharts

Looking to implement shadcn/ui patterns?

Join our Discord community for help from other developers.


Legends solve the label problem. This React pie chart uses ChartLegend and ChartLegendContent components to display category names with color indicators below the chart, keeping the pie itself clean and uncluttered. Built with shadcn/ui and Recharts, the legend uses flex-wrap with basis-1/4 for responsive multi-row layout, showing each browser with its corresponding color swatch. This approach works better than on-chart labels when you have many categories, long category names, small slices where labels don't fit, or when you want a minimal aesthetic. Perfect for dashboards, reports, or any visualization where spatial efficiency and clean design matter.

Pattern created by @haydenbleasel

Installation

Questions you might have