Skip to content

Rating - Flowbite Vue ​

Use the rating component to show star-based review scores and testimonials from your users based on Tailwind CSS utility classes ​


Rating - Flowbite

Original reference: https://flowbite.com/docs/components/rating/

The rating component can be used to show star-based review scores with support for partial ratings, review counts, and multiple star sizes.

Default Rating ​

Use the rating prop to set how many stars are filled out of the scale (default 5). Fractional values render partial stars.

vue
<template>
  <fwb-rating :rating="4" />
</template>

<script setup>
import { FwbRating } from 'flowbite-vue'
</script>

Rating with Text ​

Use the besideText slot to render additional content — such as a score label — next to the star row.

4.75 out of 5

vue
<template>
  <fwb-rating :rating="4.75">
    <template #besideText>
      <p class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400">
        4.75 out of 5
      </p>
    </template>
  </fwb-rating>
</template>

<script setup>
import { FwbRating } from 'flowbite-vue'
</script>

Rating Count ​

Combine the besideText slot with reviewLink and reviewText to display a linked review count alongside the stars.

vue
<template>
  <fwb-rating
    :rating="1"
    :scale="1"
    review-link="#"
    review-text="73 reviews"
  >
    <template #besideText>
      <p class="ml-2 text-sm font-bold text-gray-900 dark:text-white">
        4.95
      </p>
    </template>
  </fwb-rating>
</template>

<script setup>
import { FwbRating } from 'flowbite-vue'
</script>

Star Sizes ​

Use the size prop to control the star dimensions. Available sizes are sm, md (default), and lg.

vue
<template>
    <fwb-rating size="sm" :rating="4" />
    <fwb-rating size="md" :rating="4" />
    <fwb-rating size="lg" :rating="4" />
</template>

<script setup>
import { FwbRating } from 'flowbite-vue'
</script>

Rating component API ​

FwbRating Props ​

NameTypeDefaultDescription
ratingNumber3The score to display. Fractional values render partial stars.
reviewLinkString''URL applied to the review count text. Renders an <a> when set.
reviewTextString''Text displayed as the review count label next to the stars.
scaleNumber5Total number of stars (the full-score denominator).
size'sm' | 'md' | 'lg''md'Controls the size of each star icon.

FwbRating Slots ​

NameDescription
besideTextContent rendered next to the stars (e.g. a score label or review summary).

Released under the MIT License.