Rating
Captures a single score through a compact, keyboard-accessible star scale.
@rivetui/ratingPreview
Explore each composition interactively, then open its code in the same context.
Controlled
Read the selected score immediately while preserving native form behavior.
Sizes
Use the size that matches the surrounding control density.
Required
Connect required ratings to a visible and announced validation message.
Select a rating before continuing.
Registry
Installation
Add the component source and its declared dependencies with the shadcn CLI.
Install component
bunx --bun shadcn@latest add @rivetui/ratingPublic interface
API reference
Component-specific props are listed here. Native element and Base UI props continue to pass through.
| Prop | Type | Default |
|---|---|---|
value | number | — |
defaultValue | number | — |
onValueChange | (value: number, details) => void | — |
max | number | 5 |
size | "sm" | "md" | "lg" | "md" |
getItemLabel | (value: number, max: number) => string | "{value} out of {max} stars" |
name | string | — |
required | boolean | false |
disabled | boolean | false |