Skip to content

Design system

Documentation

DesignComponents / Rate

Components / Rate

Stable

Rate

Collect or display a bounded integer rating with radio-group keyboard behavior.

On this page

Examples

Selectable rating

A named radio group supports keyboard selection.

Product rating
4 of 5 stars

Product rating

Read-only rating

Show a saved score without making it interactive.

Customer rating
4 of 5 stars

Read-only customer rating

Disabled rating

Keep the rating control visible while unavailable.

Not yet rated
0 of 5 stars

Disabled rating

Try the rating

Change the score and maximum rating.

Product rating
3 of 5 stars

Rating property playground

Usage

import { Rate } from "@phuctech/ui/components/rate";

<Rate label="Product rating" defaultValue={4} onValueChange={setRating} />

Rate supports integer scores from 1 through max. The default maximum is five and is clamped to the supported range of one through ten. It intentionally does not implement half steps or rating business rules.

API

Component API
PropTypeDefaultDescriptionConstraints
labelstringrequiredVisible and accessible group name.Use a short question or criterion.
value / defaultValuenumberunselectedControlled score or initial score.Integer from 1 to max; 0 represents no selected rating only in display state.
maxnumber5Number of available levels.Integer values are clamped to 1–10; invalid values use 5.
onValueChange(value: number) => void—Called when a user selects a score.The feature owns persistence and validation.
disabled / readOnlybooleanfalseForwards unavailable and non-editable states to the shared RadioGroup.Read-only remains focusable according to RadioGroup behavior.

Accessibility

Rate uses the shared RadioGroup for one-tab-stop keyboard navigation and arrow-key choice. Every star has an explicit score label. The visible criterion names the rating, and the current score is announced politely.