RatingInput
Forms & Input

RatingInput

Interactive star input with hover preview, keyboard navigation (Arrow keys + Home/End), and optional level labels.

Props

RatingInput extends HTMLAttributes<HTMLDivElement>. Each star is a focusable button; the group is a single tabIndex=0 role="slider".

RatingInputProps props
PropTypeDefaultDescription
valuenumber—Controlled value.
defaultValuenumber—Initial uncontrolled value.
onChange(value: number) => void—Change handler.
maxnumber5Number of stars.
sizenumber16Star size in px.
disabledboolean—Prevents interaction.
clearablebooleantrueClicking the current value clears it to 0.
labelsstring[]—Text for each level, shown beside the stars (index 0 = one star).
colorstringvar(--m-color-warn)Star fill color.

Examples

Interactive

Interactive rating

With labels

RatingInput with labels

Disabled

Disabled RatingInput

Custom max and size

RatingInput with 10 stars
ImportTSX
import { RatingInput } from "@solarius/onset";
import type { RatingInputProps } from "@solarius/onset";