JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q46147F
  • License MIT

A Svelte library to select and display rating using stars.

Package Exports

  • svelte-star-ratings/Rating.svelte
  • svelte-star-ratings/Star.svelte
  • svelte-star-ratings/package.json

Readme

Svelte Rating

A simple star rating component for Svelte.

Svelte Rating

Usage

Install from npm

npm install svelte-star-ratings --save

Import the component

<script>
    import Rating from 'svelte-star-ratings/Rating.svelte';
    let value = 1;
</script>

<Rating
    maxRating={5}
    bind:value={value}
    on:change={(e) => console.log('Value', e.detail)}
/>
{value}

Properties

Property Type Description Default
value Number A property that defines the current rate -1
maxRating Number A property that defines the maximum rate. 5
mode String <"edit","read"> A property that defines if rating is in read or edit mode. edit
change Function A callback function called when the rate changes