UseRatingOptions
Properties
Section titled “Properties”allowClear?
Section titled “allowClear?”optional allowClear?: boolean;Re-selecting the current value clears to 0.
Default
Section titled “Default”true when interactivedefaultValue?
Section titled “defaultValue?”optional defaultValue?: number;Uncontrolled initial score. Ignored when value is provided.
disabled?
Section titled “disabled?”optional disabled?: boolean;optional id?: string;Base id; option inputs derive ${id}-1, ${id}-2, …
optional max?: number;Number of icons rendered. Positive integer.
Default
Section titled “Default”5optional name?: string;Radio group name; also emits a value readable by a native <form>.
onBlur?
Section titled “onBlur?”optional 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?”optional 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?”optional 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?”optional 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?”optional precision?: number;Quantization grid: 1 = whole icons, 0.5 = halves, 0 = continuous.
Default
Section titled “Default”0readOnly?
Section titled “readOnly?”optional readOnly?: boolean;Force read-only even when onChange is present.
Default
Section titled “Default”!onChange
rounding?
Section titled “rounding?”optional rounding?: RatingRounding;Direction of the snap onto the grid.
Default
Section titled “Default”'nearest'value?
Section titled “value?”optional value?: number;Controlled score. Clamped to [0, max]; NaN/Infinity become 0.