UseRatingOptions
Properties
Section titled “Properties”allowClear?
Section titled “allowClear?”allowClear?: boolean;Re-selecting the current value clears to 0.
Default
Section titled “Default”true when interactivedefaultValue?
Section titled “defaultValue?”defaultValue?: number;Uncontrolled initial score. Ignored when value is provided.
disabled?
Section titled “disabled?”disabled?: boolean;id?: string;Base id; option inputs derive ${id}-1, ${id}-2, …
max?: number;Number of icons rendered. Positive integer.
Default
Section titled “Default”5name?: string;Radio group name; also emits a value readable by a native <form>.
onBlur?
Section titled “onBlur?”onBlur?: (event) => void;Fires when focus leaves the whole group, not when moving between icons.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | FocusEvent<HTMLElement> |
Returns
Section titled “Returns”void
onChange?
Section titled “onChange?”onChange?: (value) => void;Providing this makes the component interactive.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | number |
Returns
Section titled “Returns”void
onHoverChange?
Section titled “onHoverChange?”onHoverChange?: (value) => void;Hover/keyboard preview; null when the preview ends.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | number | null |
Returns
Section titled “Returns”void
onWarn?
Section titled “onWarn?”onWarn?: (warning) => void;Callback invoked when a warning is emitted.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
warning | RatingWarning |
Returns
Section titled “Returns”void
precision?
Section titled “precision?”precision?: number;Quantization grid: 1 = whole icons, 0.5 = halves, 0 = continuous.
Default
Section titled “Default”0readOnly?
Section titled “readOnly?”readOnly?: boolean;Force read-only even when onChange is present.
Default
Section titled “Default”!onChange
rounding?
Section titled “rounding?”rounding?: RatingRounding;Direction of the snap onto the grid.
Default
Section titled “Default”'nearest'value?
Section titled “value?”value?: number;Controlled score. Clamped to [0, max]; NaN/Infinity become 0.