Rating

The Rating component displays a visual rating scale, allowing users to select or view a rating value. It supports both interactive and read-only modes.

Usage & Examples

Default

default.tsx

<Rating 
  value={3}
  onChange={(val) => console.log(val)} 
/>

Props API

19 props
Columns
Rating props API
Default
Description
aria-describedbystringNoariaReferences the id of an element that describes the rating group.
aria-labelstringNoariaAccessible label for the rating group. Prefer `label` when a visible label is needed.
aria-labelledbystringNoariaReferences the id of an element that labels the rating group.
classNamestringNostylingOptional additional CSS class names for custom styling.
data-testidstringNotestingBackward-compatible alias for test ID attributes.
glassbooleanNopropsconfigured default glass setting (fallback: false)Adds a translucent glass surface behind the rating stars.
idstringNopropsOptional unique id for the rating group.
interactivebooleanNopropstrueIf true, the user can interact with the rating (hover, click, keyboard navigation).
labelstringNopropsVisible label for the rating component.
maxnumberNoprops5The maximum number of stars available for the rating.
onChange((rating: number) => void)NoeventsCallback function invoked when the rating changes. Receives the new rating (1-indexed) as its argument.
readOnlybooleanNopropsfalseIf true, the rating is read-only and cannot be changed.