Join our Discord community
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

Loading component...

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

PropTypeDefaultDescription
classNamestring-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, and fill 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