Skip to content
🌏 Translated with the assistance of DeepSeek and ChatGPT

Rate

It seems like everyone likes to rate with stars.

Basic Usage

The Rate component enters controlled mode when the modelValue is passed. If modelValue is not passed or is undefined, it is in uncontrolled mode, in which case a defaultValue can be provided as the initial value.

Hide source code

Half Stars

The allowHalf prop controls whether half-star selections are allowed.

Hide source code

Readonly and Disabled

Hide source code

Clearable

When clearable is set to true, clicking on the position corresponding to the current value will clear the Rate value and set it to 0.

Hide source code

Custom Color

activeColor sets the color when the star is active.

Hide source code

API

RateProps

AttributeTypeOptionalDefaultDescriptionVersion
modelValuenumber | nullTrueThe value of the Rate component (controlled mode).0.2.0
defaultValuenumber | nullTrueThe default value of the Rate component (uncontrolled mode).0.2.0
disabledbooleanTruefalseWhether the component is disabled.0.2.0
readonlybooleanTruefalseWhether the component is read-only.0.2.0
clearablebooleanTruefalseWhether the value can be cleared.0.2.0
countnumberTrue5The number of selectable icons.0.2.0
allowHalfbooleanTruefalseWhether half-star selection is allowed.0.2.0
activeColorstringTrue'#FFCC33'The color when active. See Supported Color Parsing.0.2.0
pollSizeChangebooleanTruefalseEnables polling for component size changes. This may impact performance.0.2.0

RateEvents

EventParameterDescriptionVersion
update:modelValuevalue: numberCallback fired when modelValue needs to be updated.0.2.0
changevalue: number, event: EventCallback fired when the rating value changes.0.2.0
selectvalue: number, event: MouseEventCallback fired when a rating icon is selected.0.2.0
clearvalue: number, event: MouseEventCallback fired when the rating is cleared.0.2.0
focusevent: FocusEventCallback fired when the component receives focus.0.2.0
blurevent: FocusEventCallback fired when the component loses focus.0.2.0