Skip to main content
Vuetify0 is now in alpha!
Vuetify0 Logo
Theme
Mode
Palettes
Accessibility
Vuetify One
Sign in to Vuetify One

Access premium tools across the Vuetify ecosystem — Bin, Play, Studio, and more.

Not a subscriber? See what's included

Rating

Headless rating input with hover preview, keyboard navigation, and half-step support.

Usage

Rating supports whole and half-star modes. Items expose their state via data attributes for CSS-only styling.

Anatomy

vue
<script setup lang="ts">
  import { Rating } from '@vuetify/v0'
</script>

<template>
  <Rating.Root>
    <Rating.Item />

    <Rating.HiddenInput />
  </Rating.Root>
</template>

Examples

Accessibility

Keyboard

KeyAction
ArrowRight / ArrowUpIncrement by step (1 or 0.5)
ArrowLeft / ArrowDownDecrement by step
HomeSet to 0
EndSet to size

ARIA

Rating.Root provides role="slider" with aria-valuenow, aria-valuemin, aria-valuemax, and aria-valuetext (e.g. “3 out of 5”). When disabled or readonly, the corresponding aria-disabled and aria-readonly attributes are set.

Data Attributes

Root:

AttributeDescription
data-disabledPresent when disabled
data-readonlyPresent when readonly
data-hoveringPresent during hover

Item:

AttributeValuesDescription
data-statefull | half | emptyFill state
data-highlightedpresent/absentWithin hover range
data-disabledpresent/absentInherited from root
data-readonlypresent/absentInherited from root

API Reference

The following API details are for all variations of the Rating component.
Was this page helpful?

Ctrl+/