A simple, customizable Star Rating UI widget built with React + Vite. This project was created as a hands-on learning exercise to practice essential React concepts such as component structure, state management, event handling, conditional rendering, and reusable UI components.
GitHub Pages: https://ryanaxondev.github.io/react-rating-widget
- ⭐ Interactive 5-star rating system
- 🎨 Customizable colors, headings, and feedback messages
- 🖱️ Hover effects for dynamic star highlighting
- 💬 Real-time feedback text based on selected rating
- 🪟 Modal popup confirming the submitted rating
- 🔁 Reset state after closing the modal
- 🧩 Reusable components (
Button,Star,Modal) - ⚡ Built with Vite for fast development and HMR
- 🔍 ESLint + Prettier configured for clean, consistent code
This project was created as my first React learning project. It helped me practice several important concepts:
Breaking the UI into small, reusable pieces:
Rating→ container component (logic + state)Star→ presentational componentModal→ conditional UIButton→ reusable UI element
Learned how to manage:
ratinghoversubmitted
And how UI reacts to state changes.
- Click events for rating selection
- Hover events for previewing stars
- Resetting the UI on modal close
The Rating component accepts:
headingcolorfeedbackMessages
This makes the component flexible and reusable.
Used to:
- Show feedback only after selecting a star
- Display modal only when “Submit” is clicked
- Change star color based on hover vs selected rating
Configured and used:
- ESLint (with react-hooks & react-refresh)
- Prettier (with recommended rules)
- Vite build system
- React 19
- Vite 7
- JavaScript (ES6+)
- ESLint + Prettier
- CSS
react-rating-widget/
├── src/
│ ├── components/
│ │ ├── Rating.jsx
│ │ ├── Star.jsx
│ │ ├── Modal.jsx
│ │ └── Button.jsx
│ ├── assets/
│ ├── App.jsx
│ ├── main.jsx
│ └── index.css
│
├── public/
│ └── favicon.ico
│
├── eslint.config.js
├── prettier.config.js
├── vite.config.js
├── package.json
└── README.md
git clone https://github.com/ryanaxondev/react-rating-widget.git
cd react-rating-widgetnpm installnpm run devnpm run build@eslint/jsrecommended ruleseslint-plugin-react-hookseslint-plugin-react-refresheslint-plugin-prettier
- Semi-colons
- Single quotes
- Trailing commas
- 80-char line width
- 2-space indentation
Lint & format commands:
npm run lint
npm run formatSome enhancements I might add later:
- Smooth animations for stars
- Dark/Light theme
- Ability to save rating to localStorage
- Using TypeScript
- More styling + transitions
- Turning it into an npm package
This project is licensed under the MIT License.
