Embed the Rating component in your React application like this:
Set the React rating component to read-only by adding readOnly
property. This disables interaction, preventing users from changing the displayed rating value.
Add the disabled
boolean property to give it a grayed out appearance, remove pointer events, and prevent focusing.
Enable descriptive text on hover by adding tooltips
prop. This provides immediate feedback or guidance as the user interacts with the rating items.
For custom messages, provide an array of labels corresponding to each rating value to enhance the user's understanding of each rating level.
Larger or smaller react rating component? Add size="lg"
or size="sm"
for additional sizes.
Adjust the granularity of the Rating component by setting precision
prop. This attribute allows for fractional ratings, such as quarter values, to provide more precise feedback.
Control the total number of rating items displayed by using itemCount
property. You can create a React rating component with a custom scale, be it larger for detailed assessments or smaller for simplicity.
Customize the React rating component with your choice of SVG icons by assigning new values to the activeIcon
and icon
properties in the JavaScript options. This allows for a unique look tailored to the design language of your site or application.
For a more dynamic experience, define different icons for each rating value, enhancing the visual feedback: