npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-pie-chart-explode

v1.0.1

Published

React pie chart component with hover explode animation

Readme

react-pie-chart-explode

A React pie chart component with smooth hover explode animation.

Installation

npm install react-pie-chart-explode

Demo

Pie Chart Demo

Usage

import { PieChart, PieChartConfig, PieSlice } from 'react-pie-chart-explode';

const data: PieSlice[] = [
  { value: 47, label: 'Category A', color: '#4CAF50' },
  { value: 25, label: 'Category B', color: '#2196F3' },
  { value: 15, label: 'Category C', color: '#FF9800' },
  { value: 13, label: 'Category D', color: '#E91E63' },
];

const config: PieChartConfig = {
  width: 500,
  height: 500,
  explodeOffset: 20,
  animationDuration: 200,
  showLabels: true,
  showPercentage: true,
};

function App() {
  return (
    <PieChart
      data={data}
      config={config}
      onSliceClick={(slice, index) => console.log('Clicked:', slice.label)}
    />
  );
}

Props

PieChartProps

| Prop | Type | Description | |------|------|-------------| | data | PieSlice[] | Required. Array of data slices | | config | PieChartConfig | Chart configuration options | | className | string | CSS class for the container | | style | CSSProperties | Inline styles for the container | | onSliceClick | (slice, index) => void | Callback when a slice is clicked | | onSliceHover | (slice, index) => void | Callback when a slice is hovered | | tooltipRenderer | (slice, percentage) => ReactNode | Custom tooltip renderer |

PieSlice

| Property | Type | Description | |----------|------|-------------| | value | number | Required. Numeric value for the slice | | label | string | Required. Label text | | color | string | Required. Fill color (hex, rgb, etc.) |

PieChartConfig

| Property | Type | Default | Description | |----------|------|---------|-------------| | width | number | 400 | Chart width in pixels | | height | number | 400 | Chart height in pixels | | innerRadius | number | 0 | Inner radius (0 for pie, >0 for donut) | | outerRadius | number | auto | Outer radius | | explodeOffset | number | 15 | Distance to move slice on hover | | animationDuration | number | 200 | Animation duration in ms | | showLabels | boolean | true | Show label text | | showPercentage | boolean | true | Show percentage values | | showOuterLabels | boolean | true | Show labels outside the chart | | labelOffset | number | 20 | Distance of labels from chart | | strokeColor | string | '#1a1a2e' | Border color between slices | | strokeWidth | number | 2 | Border width |

Examples

Basic Pie Chart

<PieChart data={data} />

Donut Chart

<PieChart
  data={data}
  config={{
    innerRadius: 80,
    outerRadius: 150,
  }}
/>

With Custom Tooltip

<PieChart
  data={data}
  config={config}
  tooltipRenderer={(slice, percentage) => (
    <div className="tooltip">
      <strong>{slice.label}</strong>
      <p>Value: {slice.value}</p>
      <p>Percentage: {percentage.toFixed(2)}%</p>
    </div>
  )}
/>

Minimal (No Labels)

<PieChart
  data={data}
  config={{
    showLabels: false,
    showPercentage: false,
    showOuterLabels: false,
    explodeOffset: 0,
  }}
/>

Features

  • Smooth hover explode animation
  • Supports both pie and donut charts
  • Customizable colors, sizes, and animations
  • Optional labels and percentages
  • Custom tooltip support
  • Click and hover events
  • TypeScript support
  • Zero dependencies (except React)

License

MIT