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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-donut-chart-easy

v1.0.6

Published

A customizable donut chart component built with React and Tailwind CSS and typescript

Readme

React Donut Chart Easy

Live Demo: View the live demo here 🚀

A customizable donut chart component built with React and styled using Tailwind CSS. This package allows you to easily integrate a donut chart into your React applications with various configuration options for customization.

Table of Contents

Installation

To install the react-donut-chart-easy package, run the following command:

npm install react-donut-chart-easy

Make sure you have Tailwind CSS set up in your project. If you haven't done that yet, follow the Tailwind CSS installation guide.

Usage

To use the DonutChart component, import it into your React component and provide the necessary props.

import React from "react";
import DonutChart from "react-donut-chart-easy";

const App = () => {
  const data = [
    { label: "Category 1", value: 30 },
    { label: "Category 2", value: 70 },
  ];

  return (
    <div className="flex justify-center items-center h-screen">
      <DonutChart
        data={data}
        width={300}
        height={300}
        colors={["#4A90E2", "#E94E77"]}
        strokeWidth={10}
        onClick={(data) => console.log(data)}
      />
    </div>
  );
};

export default App;

Props

The DonutChart component accepts the following props:

| Prop | Type | Description | | ------------- | -------- | ----------------------------------------------------------------------- | | data | Array | An array of objects containing label and value for each segment. | | width | Number | The width of the donut chart. Default is 300. | | height | Number | The height of the donut chart. Default is 300. | | colors | Array | An array of colors for the segments. Default is a predefined color set. | | strokeWidth | Number | The width of the stroke for the donut chart. Default is 10. | | onClick | Function | A callback function that is called when a segment is clicked. |

Legend Options

The DonutChart component includes a configurable legend. You can control its visibility and position using the following props:

| Prop | Type | Default | Description | | ---------------- | ------- | ---------- | -------------------------------------------------------------------- | | showLegend | Boolean | true | Whether to display the legend. | | legendPosition | String | "bottom" | Position of the legend: "top", "bottom", "left", or "right". |

Legend Appearance

The legend is styled with a modern card-like design:

  • Each legend item has a background color matching the corresponding chart slice.
  • The label and value are displayed together for better clarity.

Customization

You can customize the appearance of the donut chart by modifying the colors, width, height, and strokeWidth props. Additionally, you can handle click events on the chart segments using the onClick prop.

License

This project is licensed under the MIT License. See the LICENSE file for details.