A simple, customization star rating component for your vue3 projects

Overview

vue3-star-ratings


A simple, customizable component for star ratings

Documentation


Features

  • Uses svg for the stars, so it can scale without quality loss
  • Customizable number of stars/ratings
  • Customizable step for the rating eg 0.5 0r 0.2
  • Customizable colors

Installation and usage


npm install vue3-star-ratings --save

You can use register it globally like this:

import { createApp } from "vue";
import App from "./App.vue";
import vue3StarRatings from "vue3-star-ratings";

const app = createApp(App);

app.component("vue3-star-ratings", vue3StarRatings);

then use it this in your component: <vue3-star-ratings />

Alternatively, you can use it directly:

<!-- your-component.vue -->

<template>
  <vue3-star-ratings v-model="rating" />
</template>

<script>
import { defineComponent } from "vue";
import vue3starRatings from "vue3-star-ratings";

export default defineComponent({
  components: {
    vue3starRatings,
  },
});
</script>

Browser with CDN

<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/vue3-star-ratings/dist/vue3-star-ratings.min.js"></script>
const { createApp } = Vue;
const App = {
  //Component code...
};
const app = createApp(App);
app.component("vue3StarRatings", Vue3StarRatings);
app.mount("#app");

Vue3StarRatings uses v-model to sync the rating between the components and its parent :

<vue3-star-ratings v-model="rating"/>.

You can customize the component by taking a look at the props table below.

Props

Prop Description Type Default
starSize This is the height and width of the stars in pixels String Or Number 32
starColor This is the color of the stars when active String #ff9800
inactiveColor This is the color of the stars when inactive String #333
numberOfStars This is the number of stars shown and also the totalRating rating possible Number 5
step This is the increment or decrement when the control buttons are clicked Number 0.5
controlBg This is the background of the control buttons String #2e5090
controlColor This is the color of the color buttons String #fff
controlSize This is the size of the the control buttons String Or Number 24
showControl This is the option to choose if the control buttons are being shown Boolean true
disableClick This is the option to disabled click on the stars, use in conjunction with the showControl Prop Boolean false
v-model Sync the rating between the component and its parent ('Where it is been used')
You might also like...

This repo contains a fully configured nuxt 3 instance supporting TypeScript and several considered as useful libraries, fully configured and ready to use in real world projects!

Nuxt 3 Starter This repo contains a fully configured nuxt 3 instance supporting TypeScript and several considered as useful libraries, fully configure

Dec 27, 2022

Template for front-end projects

⚡ vite-super-ssr template This template repo tries to achieve the minimum viable example for a modern front-end application The list of features: ✅ Vi

Dec 26, 2022

🌈 CLI tool to scaffold chakra ui projects, without wasting time.

🌈 CLI tool to scaffold chakra ui projects, without wasting time.

Create Chakra Project (create-chakra) ⚒ Tool to scaffold chakra apps, without wasting time. It uses existing tools like create-next-app and create-vit

Nov 29, 2022

We open the tools we use in our projects to all developers.

huntersofbook This repo was created with the aim of developing the vue ecosystem as well as giving back to the open-source world what we learned from

Dec 27, 2022

📓 The UI component explorer. Develop, document, & test React, Vue, Angular, Web Components, Ember, Svelte & more!

📓 The UI component explorer. Develop, document, & test React, Vue, Angular, Web Components, Ember, Svelte & more!

Build bulletproof UI components faster Storybook is a development environment for UI components. It allows you to browse a component library, view the

Jan 9, 2023

🐉 Material Component Framework for Vue

🐉 Material Component Framework for Vue

Supporting Vuetify Vuetify is a MIT licensed project that is developed and maintained full-time by John Leider and Heather Leider; with support from t

Jan 3, 2023

Universal select/multiselect/tagging component for Vue.js

Universal select/multiselect/tagging component for Vue.js

vue-multiselect Probably the most complete selecting solution for Vue.js 2.0, without jQuery. Documentation Visit: vue-multiselect.js.org Sponsors Gol

Jan 6, 2023

Everything you wish the HTML select element could do, wrapped up into a lightweight, extensible Vue component.

vue-select Everything you wish the HTML select element could do, wrapped up into a lightweight, zero dependency, extensible Vue component. Vue Selec

Jan 2, 2023

:fire::fire::fire: 强大的动态表单生成器|form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON.

:fire::fire::fire: 强大的动态表单生成器|form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON.

form-create form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions thr

Jan 3, 2023
Owner
Abiodun Olunu
M.E.V.N Stack developer.
Abiodun Olunu
A text replacer component for vue3.

A text replacer component for Vue 3. Requires Vue 3 as peer-dependency. Installation Install it from npm. npm install vue3-replacer pnpm add vue3-rep

Kadir Yazıcı 4 Feb 19, 2022
A API documentation generator for Vue3 single file component.

doc-vue A API documentation generator for Vue3 single file component. Table of Contents Installation Write API Description Command Line Usage Programm

annnhan 36 Oct 20, 2022
🎉🎉使用Vite + Vue3 + TypeScript + Element-plus + Mock开发的后台管理系统🎉🎉

Vite-Vue-Admin 介绍 Cli 配置 vue3.X vuex@4 vue-router@4 vite@2 typescript mock 内置 element-plus 二开封装 upload-file (文件上传,支持指定文件格式,文件大小) powerful-table (多功能表格

PengXiaoShuai 103 Dec 17, 2022
使用 vue3 来实现俄罗斯方块

Tetris-vue3 使用 vue3 实现俄罗斯方块 单机版本实现 联机版本实现 实现原理 采用了 Functional Core, Imperative Shell 模式来实现 提高了可测试性 业务核心逻辑和视图逻辑拆分 可以移植到任意 UI 库 todo 游戏重来 收获 应用程序从 0 到 1

阿崔cxr 29 Mar 25, 2022
vite2.7 + vue3.2 + ts + eslint + prettier

vite-vue-template 一个vue3项目模板 主要依赖 vite 2.7.2 vue 3.2.25 typescript eslint prettier 准备 Windows系统下将编辑器 行尾(eol) 设置为 LF('\n') vscode配置: { "files.eol":

shaaaaaaaa 5 Sep 13, 2022
⏳ vue3 + electron + ts + vite = mini template

v3-electron ?? Electron16 + Vue3 + Vite2 运行项目 # enter the project directory cd v3-electron # install dependency yarn # develop yarn dev # build exe

UNPany 8 Nov 11, 2022
vite+vue3.2+setup+elementPlus+eslint+js+stylelint

前期准备工作,npm包和vscode配置 !!!很重要,关乎整个Vue3开发阶段的代码提示 Volar使用 使用Vue3开发需要禁用vscode插件Vetur 然后安装 Volar(Vue Language Features),这样Vue3代码提示即使是使用js开发也非常友好 如果volar没有任何

null 2 Feb 8, 2022
vue3 + vite + typescript template

Vue 3 + Typescript + Vite This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 <script setu

BrowLi 6 Aug 1, 2022
Vue3 SSR prod-ready multi-languages template

vue3-ssr-template About This template is a prod ready starter for your Vue SSR application where you can do what you want at any level, client or serv

null 9 Mar 11, 2022
Make your Vite projects work in IE11 and other legacy browsers.

vite-plugin-legacy-dev Maybe your Vite project needs work on IE11 or other not support ESM legacy browsers, this plugin can help you! This is only for

haiya6 3 Sep 26, 2022