Mark Yo

Donut Chart

Component

About

An animated donut or pie chart that sweeps its slices into view, highlights the hovered slice, and swaps its center readout between the total and the active slice's value and share.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Donut Chart to your project and fits it to your theme.

Code

How Donut Chart is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { DonutChart } from "@/components/ui/chart-donut";

export default function DonutChartDemo() {
  return (
    <div className="flex w-full items-center justify-center p-10">
      <DonutChart
        title="Revenue by channel"
        data={[
          { label: "Direct", value: 4200 },
          { label: "Organic search", value: 3100 },
          { label: "Referral", value: 1800 },
          { label: "Social", value: 950 },
          { label: "Email", value: 600 },
        ]}
      />
    </div>
  );
}

Dependencies

More by Mark Yo

View all
  • Loader

    Loader

    67
  • Pricing Table

    Pricing Table

    24
  • Bento Grid

    Bento Grid

    10
  • Wallet Card

    Wallet Card

    4
  • Expandable Tabs

    Expandable Tabs

    4
  • Image Gallery

    Image Gallery

    3
  • CTA Section

    CTA Section

    3
  • Bar Chart

    Bar Chart

    1