Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue3-star-ratings-ksh

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-star-ratings-ksh

A simple, customizable vue3 component for star ratings

  • 2.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47
increased by4.44%
Maintainers
1
Weekly downloads
 
Created
Source

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-ksh --save

You can use register it globally like this:

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

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/vue@3.0.0"></script>
<script src="https://unpkg.com/vue3-star-ratings-ksh/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

PropDescriptionTypeDefault
starSizeThis is the height and width of the stars in pixelsString Or Number32
starColorThis is the color of the stars when activeString#ff9800
inactiveColorThis is the color of the stars when inactiveString#333
numberOfStarsThis is the number of stars shown and also the totalRating rating possibleNumber5
stepThis is the increment or decrement when the control buttons are clickedNumber0.5
controlBgThis is the background of the control buttonsString#2e5090
controlColorThis is the color of the color buttonsString#fff
controlSizeThis is the size of the the control buttonsString Or Number24
showControlThis is the option to choose if the control buttons are being shownBooleantrue
disableClickThis is the option to disabled click on the stars, use in conjunction with the showControl PropBooleanfalse
v-modelSync the rating between the component and its parent ('Where it is been used')

Keywords

FAQs

Package last updated on 28 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc