Skip to content
Forms

Rating

Star rating input — interactive or read-only, with optional half stars.

Import

tsx
import { Rating } from "@cooud-ui/ui";
bash
npx cooud-ui add rating

Examples

API Reference

Generated from the component's exported types.

RatingProps

Extends VariantProps<typeof ratingVariants>

PropTypeDefaultDescription
value
numberControlled value. Pair with `onValueChange`.
defaultValue
number0Initial value for uncontrolled usage. Defaults to `0`.
onValueChange
(value: number) => voidCalled with the new value whenever the rating changes.
max
number5Number of stars. Defaults to `5`.
readOnly
booleanfalseRenders display-only with no interaction. Defaults to `false`.
allowHalf
booleanfalseAllows half-star (0.5) granularity. Defaults to `false`.
size
"sm" | "md" | "lg""md"Star size preset. Defaults to `"md"`.
aria-label
stringAccessible name for the rating when there is no visible label.
aria-labelledby
stringID of an element labelling the rating.
className
stringExtra classes for the wrapper element.