DEV Community

Cover image for Introducing react-number-rating – A 1–10 React Rating Component for Better UI
Raj Kumar
Raj Kumar

Posted on

Introducing react-number-rating – A 1–10 React Rating Component for Better UI

πŸ”₯ Introduction

β€œThe react-number-rating component helps you add clean, user-friendly numeric rating systems (1–10) in React apps with minimal setup.”

If you're building a feedback form, product rating, or any kind of review system in a React app, you’ve probably used stars, sliders, or emojis. But what if you want something more precise, clean, and customizable?

Introducing react-number-rating β€” a modern and developer-friendly rating component for React that displays a numeric scale from 1 to 10, with optional color coding to visually represent the score strength.

πŸ”— Live Demo

πŸ‘‰ Try it on CodeSandbox

✨ Features

βœ… Numeric scale from 1 to 10
βœ… Custom color for each number
βœ… Easily style via props or CSS
βœ… Lightweight – no external styling libraries
βœ… Built with React 17/18 compatibility
βœ… Perfect for feedback forms, review UIs, or product ratings

πŸ“¦ Installation

Install via NPM:

npm install react-number-rating

πŸ› οΈ Usage Example

import React, { useState } from "react";
import PriorityRating from "react-number-rating";

export default function App() {
  const [priority, setPriority] = useState(5);
  return (
    <PriorityRating
      max={10}
      value={priority}
      name="priority"
      onChange={(val) => setPriority(val)}
    />
  );
}
Enter fullscreen mode Exit fullscreen mode

πŸ’‘ Tip: The onChange callback lets you hook into form logic easily.

βš™οΈ Props Breakdown

Prop Type Description
value number The current rating value (1–10)
onChange func Callback function when a rating is selected
activeColor string Color of selected rating numbers (default: #1976d2)
inactiveColor string Color of unselected numbers (default: #e0e0e0)
size string Size of the number buttons (small, medium, large)

🎯 Real-World Use Cases

  • User feedback forms
  • Product reviews
  • Quiz or exam grading UI
  • Habit tracking (e.g., rate your productivity)

πŸ§‘β€πŸ’» About the Author

I’m Rajkumar, a passionate frontend engineer focused on building modular and reusable UI solutions. This is part of my effort to help developers quickly ship polished user experiences in React.

πŸ‘‰ GitHub
πŸ‘‰ Buy Me a Coffee

πŸ’– Support the Project

If you find this useful, consider supporting me:

⭐ Star the repo on GitHub

πŸ§‘β€πŸ’» Try it in your next React project

πŸ’Έ Sponsor via GitHub

β˜• Buy Me a Coffee

πŸ“Œ Final Thoughts

react-number-rating is a tiny but powerful component that brings numeric clarity to user ratings in React apps. Whether you're building SaaS, dashboards, or mobile-first apps, it's plug-and-play ready.

Have suggestions or want to contribute? PRs are always welcome!

Top comments (0)