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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-char-fill

v1.0.20

Published

A React component for creating flexible character-based ratings, perfect for star ratings and other similar use cases.

Downloads

96

Readme

npm version

React Char Fill

A versatile React component library for creating customizable character-based ratings. Ideal for star ratings and other similar applications, with fine-grained control over rating steps, colors, and interactivity.


📺 Live Demo

Experience the component in action: Live Demo


🚀 Installation

Install the package using your preferred package manager:

npm install react-char-fill

or

yarn add react-char-fill

or

bun add react-char-fill

📚 Usage

Basic Example

import CharacterRating from 'react-char-fill';

const App = () => {
  return (
    <CharacterRating
      rating={3.5}
      character="★"
      maxRating={5}
      emptyColor="lightgray"
      fillColor="gold"
      interactive={false}
      step={0.5}
    />
  );
};

export default App;

Advanced Example

import CharacterRating from 'react-char-fill';

const App = () => {
  return (
    <CharacterRating
      rating={4.2}
      character="☆"
      maxRating={10}
      emptyColor="#e0e0e0"
      fillColor="#ffeb3b"
      fontSize="32px"
      interactive={true}
      step={0.1}
    />
  );
};

export default App;

🔧 API Documentation

CharacterRating

This component displays a rating using characters and provides the ability to customize and interact with the rating.

Props

  • rating (number, required): The current rating value.
  • character (string, required): The character used to represent the rating.
  • maxRating (number, required): The maximum rating value.
  • emptyColor (string, optional): The color for the empty rating characters. Default is lightgray.
  • fillColor (string, optional): The color for the filled rating characters. Default is gold.
  • fontSize (string, optional): The size of the rating characters. Default is 24px.
  • interactive (boolean, optional): If true, the rating can be changed by the user. Default is true.
  • step (number, required): The increment step for the rating value.
  • onMouseMove (function, optional): Function to call on mouse move.
  • onClick (function, optional): Function to call on click.
  • onKeyDown (function, optional): Function to call on key down.

🤝 Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch with your changes: git checkout -b my-feature-branch.
  3. Commit your changes: git commit -am 'Add new feature'.
  4. Push to the branch: git push origin my-feature-branch.
  5. Create a pull request.

🏗️ Publishing

To publish a new version of the react-char-fill package, follow these steps:

  1. Build and Preview: First, build and preview the project to ensure everything works as expected.

    bun run bp

    This command will build the library and start a preview server. Verify that the build is successful and the preview behaves as intended.

  2. Commit Changes: If everything works fine, commit any changes made to the repository.

    git add .
    git commit -m "Your commit message"
  3. Bump Version: After committing, bump the version number. This will update the package.json version and create a new commit with the version bump.

    bun run bump
  4. Publish: Finally, publish the package to npm and GitHub Packages.

    bun run publish

    This command will build the library, publish the package to npm and GitHub Packages, and ensure everything is correctly versioned and released.

By following these steps, you can ensure that each release is built, tested, and published consistently.


📄 License

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