Toggle Sidebar B
AppearanceLight & dark mode D

Peek Rating

Star rating that previews the score under the pointer: glyphs rise, the one you point at swells and a tip hops along above the row.

Default

Hover or drag across the glyphs to preview a score, then click to commit it. Click the current score again to clear it.

Dark previewReplay previewOpen in new tab

Customize

Value3
Count5
Shape
Active
Idle
Tip
Tip Text
Size40px
Lift8px
Magnify1.15
Rise320ms
Pop1.3

API Reference

PeekRating

PropTypeDefaultDescription
valuenumberundefinedControlled rating from 0 to count, bound with v-model:value.
defaultValuenumber0Initial rating when uncontrolled.
countnumber5Number of glyphs.
shape'star' | 'heart' | 'bolt''star'Built-in glyph shape.
labelsstring[][]One label per glyph, shown in the tip while previewing. Without labels the tip shows the number.
activeColorstring'#f5b400'Colour of lit glyphs and of the focus ring.
idleColorstring'#52525b'Colour of unlit glyphs.
tipColorstring'#27272a'Background of the tip that follows the pointer.
tipTextColorstring'#f5f5f5'Text colour of the tip.
sizenumber28Glyph size in pixels. Spacing and the tip scale with it.
liftnumber6How far previewed glyphs rise, in pixels. 0 makes the preview colour-only.
magnifynumber1.15Scale of the glyph under the pointer.
riseDurationnumber320Duration in milliseconds of each glyph's rise and fall, and of the tip's hop.
popScalenumber1.3Peak scale of the pop on the committed glyph. 1 disables it.
showTipbooleantrueShows the tip above the pointer glyph while previewing.
allowClearbooleantrueClicking the current rating again, or Backspace, clears it to 0.
readOnlybooleanfalseDisplay only: no preview, no pop, announced as an image.
disabledbooleanfalseDims the control and ignores input.
ariaLabelstring'Rating'Accessible name of the radio group.
EventDescription
changeEmitted with the committed rating, by click, release or keyboard.
previewEmitted with the previewed rating on every slot crossing, and with null when the preview clears.
update:valueEmitted alongside change, for v-model:value.
SlotDescription
iconCustom glyph that replaces the built-in shape. It inherits the lit and idle colour through currentColor.

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
Arrow Right + Arrow UpRaises the rating by one.
Arrow Left + Arrow DownLowers the rating by one.
Home + EndJumps to 1 or to the maximum.
Space + EnterCommits the focused glyph, or clears it when it is the current rating.
Backspace + DeleteClears the rating when allowClear is on.
  • Rendered as a radiogroup of radio buttons with a roving tabindex. With readOnly it becomes an image announcing the score.
  • With prefers-reduced-motion the glyphs no longer rise and the pop is skipped.