React
Usage
Shortcuts
The RatingGroup component also provides a set of shortcuts for common use cases.
RatingControl
This component renders the number of rating items specified in the count prop.
This works:
This might be more concise, if you don't need to customize the rating icons:
Examples
Sizes
Use the size prop to change the size of the rating component.
React
Controlled
Use the value and onValueChange prop to control the rating value.
React
ReadOnly
Use the readOnly prop to make the rating component read-only.
React
Custom Icon
Use the icon prop to pass a custom icon to the rating component. This will override the default star icon.
React
Label
Render the RatingGroup.Label component to provide a human-readable label for the rating component.
React
Half Star
Use the allowHalf prop to allow half-star ratings.
React
Colors
Use the colorPalette prop to change the color of the rating.
React
Closed Component
Here's how to setup the Rating for a closed component composition.
So that you can use it like this: