Pie chart
Simple Pie Chart
Display categorical data with proportional segments and tooltips. Perfect for React applications requiring data visualization with Next.js integration and TypeScript support.
Powered by
Installation
npx shadcn@latest add https://www.shadcn.io/registry/pie-chart-01.json
npx shadcn@latest add https://www.shadcn.io/registry/pie-chart-01.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/pie-chart-01.json
bunx shadcn@latest add https://www.shadcn.io/registry/pie-chart-01.json
Features
- Proportional data visualization with automatically calculated segment sizes
- Interactive tooltips showing values on hover with formatted display
- Customizable colors using chart design tokens and CSS variables
- Responsive design with aspect-square container and max height constraints
- TypeScript support with complete type definitions for all chart props
- shadcn/ui integration using Card, Chart, and tooltip components
Use Cases
This free open source React component works well for:
- Analytics dashboards - Display user demographics or traffic sources built with Next.js
- Financial reporting - Visualize budget allocation or expense categories using TypeScript and Tailwind CSS
- Survey results - Show response distributions with clear visual representation
- Market research - Present market share or competitive analysis data
API Reference
ChartPieSimple
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes for the card container |
Chart Configuration
The component uses a predefined configuration for browser data:
const chartConfig = {
visitors: {
label: "Visitors",
},
chrome: {
label: "Chrome",
color: "var(--chart-1)",
},
safari: {
label: "Safari",
color: "var(--chart-2)",
},
// ... additional segments
} satisfies ChartConfig;
Implementation Notes
- Chart automatically fits within aspect-square container with max height of 250px
- Data structure requires
browser
,visitors
, andfill
properties - Colors are defined using CSS variables for consistent theming
- Tooltip displays values without labels for cleaner presentation
- Uses Recharts Pie component for rendering with shadcn/ui styling
Custom Label Line Chart
Line chart with custom formatted labels using data transformation and chart configuration. Built for React applications with Next.js integration and TypeScript support.
Seamless Pie Chart
Display categorical data with seamless segments and no dividing lines. Perfect for React applications requiring clean data visualization with Next.js integration and TypeScript support.