Skip to content

Rating input

Sets a star rating with radio controls.

Rate this item
rating-input-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Custom icon

How much did you enjoy it?
rating-input-icon-demo.tsx

Read only

Average rating
rating-input-read-only-demo.tsx

Required

The error shows after the first submit. Also install Form and Button.

Rate your order
rating-input-required-demo.tsx

API reference

vip/ui adds or changes the props below. For all other props, see React Aria RadioGroup (opens in a new tab).

label: ReactNode
The visible label of the group. Without it, pass aria-label.
max: number = 5
Number of steps. Use a positive whole number.
icon: Icon = StarIcon
A Phosphor icon for each step. Steps up to the rating use the fill weight.
value: number
The selected rating, controlled. 0 means no rating. Use a number from 1 to max for a selection.
defaultValue: number = 0
The selected rating at first, uncontrolled. 0 means no rating.
onValueChange: (value: number) => void
Called when a step is selected.