Skip to content
Forms

Rating

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

Import

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

Examples

.cronus

The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.

PortedParity: MatchGeometry 1/1Pixel diff 0 pxLogic 1/1Parity scoreboard
default.cronus
app "audit-fixtures" {
  port 5176
}

style {
  preset aurora
  theme dark
}

component RatingDefault layout:inline style:rating {
  value:3
  aria-label:"Quality"
  label "Quality"
}

page "/audit/rating/default" type:custom {
  use RatingDefault
}

API Reference

Generated from the component's exported types.

RatingProps

Extends VariantProps<typeof ratingVariants>

Skip RatingProps props table
PropTypeDefaultDescription
value
number—Controlled value. Pair with `onValueChange`.
defaultValue
number0Initial value for uncontrolled usage. Defaults to `0`.
onValueChange
(value: number) => void—Called 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
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.
asChild
boolean—Render as the child element via Slot.
children
ReactNode—Contents of the component.