Skip to content

Rating

Star-based rating component for capturing or displaying user feedback. Supports hover interaction, custom sizes, colors, and read-only mode.

vue
<script setup lang="ts">
import { Rating } from '@/components/kuro/rating';
</script>

<template>
  <Rating />
</template>

Installation

bash
npx kuro-ui add rating
bash
npx github:Bartek-Nowak/Kuro add rating

Features

  • Fully accessible with keyboard and screen reader support
  • Supports readonly and editable modes
  • Hover feedback when not in read-only mode
  • Customizable variant, size, and max stars
  • Uses lucide-vue-next icons

Usage

Basic

vue
<Rating v-model="rating" />

Custom Variant and Size

vue
<Rating v-model="rating" variant="success" size="lg" />

Readonly Mode

vue
<Rating :model-value="4" readonly />

Custom Max

vue
<Rating v-model="rating" :max="10" />

Variants and Sizes

The Rating component supports several visual variants and sizes. Use the variant and size props to customize its appearance.

VariantDescription
defaultYellow stars for neutral ratings
primaryBlue stars for primary emphasis
secondaryGray stars for subdued appearance
mutedMuted gray stars for minimal contrast
destructiveRed stars indicating negative ratings
successGreen stars for positive confirmation
warningDark yellow stars for caution or warning
infoCyan stars for informational rating context
SizeDescription
smSmall star icons
mdMedium star icons (default)
lgLarge star icons

Props

PropTypeDefaultDescription
variantstringdefaultColor variant (primary, success, etc.)
sizestringmdIcon size: sm, md, or lg
maxnumber5Maximum number of stars
readonlybooleanfalseWhether the rating is read-only
classstring''Additional Tailwind classes

Dependencies