Mark Yo

Donut Chart

Component 14

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

    73
  • Pricing Table

    Pricing Table

    33
  • Approval Queue

    Approval Queue

    24
  • Bento Grid

    Bento Grid

    22
  • Expandable Tabs

    Expandable Tabs

    19
  • Image Gallery

    Image Gallery

    17
  • Wallet Card

    Wallet Card

    16
  • Feature Section

    Feature Section

    12