Rate
Star rating. The default is five stars, half-star steps, and click-again to clear. Filled stars use the brand gold; empty stars stay a neutral outline.
Demos
Basic
Half stars are on by default. Clicking the current value clears it to 0. Hover previews with
--gk-color-brand-hover. Cleared
Sizes
Glyphs are 16 / 22 / 28. The hit box stays at least 28px tall.
Readonly and disabled
Whole stars
In Vue, set
.allowHalf="false". A bare allow-half="false" attribute is still true. API
Properties
| Name | Type | Default | Notes |
|---|---|---|---|
value | number | 0 | 0 is cleared |
count | number | 5 | |
allow-half | boolean | true | |
allow-clear | boolean | true | Click the current value again |
size | sm | md | lg | md | |
color | string | brand | Filled color. Empty stays neutral |
readonly / disabled | boolean | false | |
name | string | — |
Events
change and update:value with { value }.
Parts
root, item, icon, half, full. The group is a radiogroup labelled 評分 / Rating. Each stop is a radio. A custom character slot is a follow-up.