Skip to content

Star Rate

A star rating component with support for half stars and custom styling.

Installation

bash
npx draft-cli vue add star-rate

Usage

Basic

vue
<script setup>
import { StarRate } from '@draft-ui/vue'
</script>

<template>
  <StarRate value="3.5" class="text-2xl text-yellow-500" />
</template>

Different Sizes

vue
<template>
  <StarRate value="4" class="text-sm text-yellow-500" />
  <StarRate value="4" class="text-base text-yellow-500" />
  <StarRate value="4" class="text-2xl text-yellow-500" />
  <StarRate value="4" class="text-4xl text-yellow-500" />
</template>

Different Colors

vue
<template>
  <StarRate value="3.5" class="text-2xl text-yellow-500" />
  <StarRate value="3.5" class="text-2xl text-orange-500" />
  <StarRate value="3.5" class="text-2xl text-red-500" />
  <StarRate value="3.5" class="text-2xl text-blue-500" />
</template>

API

PropTypeDefaultDescription
valuestring | numberRequiredThe rating value (supports decimals for half stars).
countnumber5Total number of stars to display.
strokeWidthnumber1.5The stroke width of the star icons.