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>
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | — | Controlled value. Pair with `onValueChange`. |
defaultValue | number | 0 | Initial value for uncontrolled usage. Defaults to `0`. |
onValueChange | (value: number) => void | — | Called with the new value whenever the rating changes. |
max | number | 5 | Number of stars. Defaults to `5`. |
readOnly | boolean | false | Renders display-only with no interaction. Defaults to `false`. |
allowHalf | boolean | false | Allows half-star (0.5) granularity. Defaults to `false`. |
size | "sm" | "md" | "lg" | "md" | Star size preset. Defaults to `"md"`. |
aria-label | string | — | Accessible name for the rating when there is no visible label. |
aria-labelledby | string | — | ID of an element labelling the rating. |
className | string | — | Extra classes for the wrapper element. |