Toggle Sidebar B
header.lightDarkMode D

Rating

Star rating with fractional display, half-star input, hover preview, and keyboard support. Interactive by default; set readonly for display-only.

Default

Interactive 5-star rating with v-model.

Fractional display

Any decimal value renders a partially filled star.

Half-star input

Click or arrow to the left half of a star for a .5 value.

2.5

Show value

Display the numeric value beside the stars.

4.0

Sizes

sm, default, lg.

Colors

yellow (default), primary, foreground.

Readonly

Display-only, no hover or keyboard.

Disabled

Dimmed and non-interactive for forms.

API Reference

Props, events, and slots for each sub-component.

Rating

Props

PropTypeDefaultDescription
modelValuenumber0Current rating. Supports v-model. Fractional values render partial fills. Clamped to [0, max].
maxnumber5Number of stars.
size"sm" | "default" | "lg""default"Star and gap size.
readonlybooleanfalseDisplay-only. Disables hover, click and keyboard.
disabledbooleanfalseDimmed and non-interactive. Use in disabled forms.
showValuebooleanfalseRender the numeric value next to the stars.
allowHalfbooleanfalseAllow half-star selection via pointer position and a keyboard step of 0.5.
clearablebooleanfalseClicking the current value resets the rating to 0.
color"yellow" | "warning" | "primary" | "foreground""yellow"Filled-star color. Default yellow matches the ReUI rating.
classstringundefinedClasses for the root container.
starClassstringundefinedClasses for each star wrapper.

Events

EventDescription
update:modelValueFires on click or keyboard change with the new rating. Enables v-model. With clearable, clicking the current value emits 0.

Accessibility

Keyboard shortcuts and ARIA behavior.

Keyboard

ShortcutDescription
TabMoves focus to or from the rating (interactive only).
ArrowRightIncrease rating by one step (0.5 with allowHalf, else 1).
ArrowUpIncrease rating by one step.
ArrowLeftDecrease rating by one step.
ArrowDownDecrease rating by one step.
HomeSet rating to 0.
EndSet rating to max.
  • When interactive, the root uses role="slider" with aria-valuemin, aria-valuemax, aria-valuenow and aria-valuetext (e.g. "3.5 of 5").
  • When readonly, the root uses role="img" with an aria-label describing the value.
  • Provide an aria-label (e.g. "Product rating") to name the control; it forwards to the root element.
  • Stars are aria-hidden; the value is conveyed entirely through ARIA attributes.