Skip to content

Rate

Enterprise-level rating component based on BrConfigProvider for global theme configuration. It supports half stars, custom icons, read-only state, and seamless integration with BrFormItem.

Basic Usage

The most basic usage of the Rate component.

Example

Half Star

Supports half-star ratings, enabled via the allow-half attribute.

Example

Custom Icon and Count

You can customize the icons and the maximum rating count.

Example

Readonly and Disabled

Read-only State (Readonly)
Disabled State (Disabled)
Example

Theme Customization

BrRate seamlessly integrates with BrFormItem and supports global theme configuration via BrConfigProvider.

Terrible
Example

API

BrRate Props

NameTypeDefaultDescription
modelValue / v-modelnumber0Current rating value
countnumber5Total number of icons
allowHalfbooleanfalseWhether to allow half-star ratings
readonlybooleanfalseWhether the component is readonly
disabledbooleanfalseWhether the component is disabled
clearablebooleanfalseWhether to allow clearing when clicked again
sizeComponentSize | number'default'Size of the rating icons
colorstring | string[] | Record<number, string>-Color when active, supports an array of colors or a piecewise color object
voidColorstring-Color when unselected
iconComponent | stringStarIcon component when active
voidIconComponent | stringStarIcon component when unselected
halfIconComponent | string-Icon component for half star (if not provided, it is implemented by clipping icon)
showTextbooleanfalseWhether to show auxiliary text
textsstring[][]Array of auxiliary texts
validationState'default' | 'success' | 'error' | 'warning''default'Validation state, automatically synced when integrated with BrFormItem

BrRate Emits

NameDescriptionCallback Parameters
update:modelValueTriggered when the rating value changes(value: number)
changeTriggered when the rating value changes(value: number)
hoverChangeTriggered when the hover rating value changes(value: number)

BrRateItem Props (Internal Item Component)

Usually not used directly, exposed for deep customization.

NameTypeDescription
valuenumberValue of the current item
activeValuenumberTotal active value
hoverValuenumberTotal hover value
allowHalfbooleanWhether half stars are allowed
readonlybooleanWhether it is readonly
disabledbooleanWhether it is disabled
sizeComponentSize | numberIcon size
colorstringActive color
voidColorstringUnselected color
iconComponent | stringActive icon
voidIconComponent | stringUnselected icon
halfIconComponent | stringHalf-star icon