vueintermediatemitFeatured

Vue Star Rating

An interactive star rating input.

9.7k1.1k675435

About this module

A Vue star rating with hover preview, half-star display, keyboard support and v-model output.

#vue#rating#stars#input

Source code

Installation

  1. 1

    Install Vue

    Create a Vue 3 project or add the component to an existing one.

    npm create vue@latest
  2. 2

    Create the component

    Create VueStarRating.vue and paste the source below.

  3. 3

    Import and use

    Import the component in your page or parent component and render it.

Usage

  1. 1

    Import the component

    Import VueStarRating in a parent component.

    import VueStarRating from "./components/VueStarRating.vue";
  2. 2

    Register and render

    Register it in your setup and render it in the template.

    <script setup>
    import VueStarRating from "./components/VueStarRating.vue";
    </script>
    
    <template>
      <vue-star-rating />
    </template>
Overview
Categorycomponents
Frameworkvue
Difficultyintermediate
Licensemit
Versionv1.0.0
Features
  • Single-file component
  • TypeScript-friendly
  • Accessible by default
Traits
  • ResponsiveYes
  • Dark modeYes
  • AccessibleYes
  • Production readyYes
Props
modelValuenumber

Current rating value.

Default: 0

maxnumber

Number of stars.

Default: 5

readonlyboolean

Disables interaction.

Default: false

Browser support
  • Chrome 90+
  • Firefox 90+
  • Safari 15+
  • Edge 90+

Related modules

Command Palette

Search modules and jump anywhere