rc-rate is a flexible and accessible React component for displaying and selecting star ratings. It is part of the extensive react-component ecosystem, known for providing foundational UI components. The package is currently at version 2.13.1 and actively maintained with frequent minor and patch releases, addressing bugs, accessibility, and adding features. Key differentiators include support for half-star selections, custom characters for stars (allowing SVG or any ReactNode), and robust keyboard navigation. It provides both controlled and uncontrolled modes of operation and ensures good accessibility practices, as evidenced by recent fixes. Developers can easily integrate it into projects that require user feedback or display ratings, with full TypeScript support provided. This component offers a solid, performant, and customizable base for rating functionalities in React applications, suitable for production use cases.
npm install rc-rateVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic usage of `rc-rate`, including uncontrolled and controlled components, half-star selection, custom star characters, and disabled states. It also includes the essential CSS import.
Consider migrating to `@rc-component/rate` for new projects or future-proofing, pending an official migration guide from the maintainers.
Add `import 'rc-rate/assets/index.css';` to your application's entry file or a relevant component to apply the default styles.
Upgrade to `rc-rate@2.13.1` or later to benefit from the corrected `role` attribute, enhancing the accessibility of your rating components.
Upgrade to `rc-rate@2.13.0` or later and utilize the new `disabledKeyboard` prop if you need to prevent keyboard interaction with the rating component.
If using `require`, modify your import statement to `const Rate = require('rc-rate').default;` to correctly access the default export.Ensure `import 'rc-rate/assets/index.css';` is present in your application code and that your build tool (e.g., Webpack, Vite) is correctly configured to process CSS files.
Verify that `react` and `react-dom` versions `>=16.9.0` are installed and resolve correctly in your project. Ensure only one instance of React is loaded, especially in monorepos or complex application setups.