Component
Rating
Icon rating input with radiogroup semantics and arrow-key navigation. The shape and color are configurable, and it supports read-only, disabled, controlled, and custom-max usage.
Sizes
- Interactive ratings expose radiogroup semantics: Arrow Right/Up increases the value, Arrow Left/Down decreases it, and only one star is a Tab stop at a time (roving tabindex).
- Fractional values (e.g. 4.8) render a proportionally filled star in both interactive and read-only ratings.
Tones
Filled color resolves through Fuji semantic tokens.
Custom shape
Pass any individually imported Lucide icon.
Custom max
Read-only and disabled
- readOnly renders a static role="img" with an accessible label like "Rated 4.8 out of 5" - it is not keyboard-focusable and does not expose radiogroup/radio roles, since it isn't an input.
- disabled keeps the radiogroup semantics (it's still a form control, just temporarily non-interactive) and is removed from the tab order natively via the disabled attribute.
Controlled
3 / 5
API reference
valueNone
numberControlled rating value.
defaultValue0
numberUncontrolled initial value.
onChangeNone
(value: number) => voidFires when the value changes.
max5
numberNumber of icons.
size"md"
"sm" | "md" | "lg"Icon size.
iconStar
LucideIconIndividually imported Lucide icon for each item.
tone"sun"
ComponentToneDecorative color of the filled icons.
readOnlyfalse
booleanDisplay only; not editable.
disabledfalse
booleanDim and disable interaction.
labelNone
stringAccessible name for the radiogroup (required).
classNameNone
stringAdditional classes applied to the component root.
