pretty-rating-react is a small React library (v2.2.0) that transforms a numeric rating into a visual display using FontAwesome icons. It supports whole, half, and empty icon states, custom icon selection, and TypeScript types out of the box. The library is actively maintained with regular releases and provides a simple API via a single <PrettyRating> component. Compared to alternatives, it focuses on simplicity and icon-based display rather than interactive rating input.
npm install pretty-rating-reactNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of the PrettyRating component with different values, custom max, and custom icon names.
Use valid FontAwesome icon names like 'fa-star' or icon objects from @fortawesome/free-solid-svg-icons.
Ensure value <= max, or adjust max prop accordingly.
Use import { PrettyRating } from 'pretty-rating-react' (named export) and remove old imports.Ensure @fortawesome/fontawesome-svg-core, @fortawesome/free-solid-svg-icons, and @fortawesome/react-fontawesome are installed and that the FontAwesome library is added (e.g., import { library } from '@fortawesome/fontawesome-svg-core'; library.add(faStar, faStarHalfAlt)).Upgrade to React 17 or 18.
Run: npm install @fortawesome/react-fontawesome
Change to: import { PrettyRating } from 'pretty-rating-react';Add: import { library } from '@fortawesome/fontawesome-svg-core'; import { faStar, faStarHalfAlt } from '@fortawesome/free-solid-svg-icons'; library.add(faStar, faStarHalfAlt);