Skip to content

RatingBar

A rating component that displays a row of stars. Supports half-star ratings and custom styling.

Usage

vue
<script setup>
import { ref } from "vue";
import { RatingBar } from "fluekit";

const rating = ref(3.5);
</script>

<template>
  <RatingBar v-model="rating" :allow-half-rating="true" />
</template>

Props

PropTypeDefaultDescription
modelValuenumber0The current rating value.
maxnumber5The maximum rating (number of stars).
sizenumber | string24The size of the stars.
colorstring | Color#FFC107The color of filled stars.
unselectedColorstring | Color#E0E0E0The color of empty stars.
allowHalfRatingbooleanfalseWhether to allow half-star ratings.
readonlybooleanfalseWhether the rating is read-only.

Events

EventPayloadDescription
update:modelValuenumberEmitted when the rating changes.

Examples

Interactive Demo

Basic Usage

Value: 3

Half Rating

Value: 2.5

Readonly

Custom Style

10 Stars

Value: 7.5

Basic Usage

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

Half Rating

vue
<RatingBar v-model="rating" allow-half-rating />

Readonly

vue
<RatingBar :model-value="4.5" readonly allow-half-rating />

Custom Style

vue
<RatingBar v-model="rating" :size="30" color="red" unselected-color="#FFCDD2" />