npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

svelt-rating-selector-display

v1.1.2

Published

This small, dependency-free Svelte component enables effortless user rating input and display. It offers seamless customization with Unicode characters to suit individual preferences. Moreover, it boasts full reactivity to ensure a smooth and dynamic user

Downloads

4

Readme

svelt-rating-selector-display

This small, dependency-free Svelte component enables effortless user rating input and display. It offers seamless customization with Unicode characters to suit individual preferences. Moreover, it boasts full reactivity to ensure a smooth and dynamic user experience. Has user accesability, and keyboard input.

Features:

  • Custom Theming
  • Custom Icons Using Unicode Characters
  • Get customer Ratings
  • Present Ratings with Utmost Precision
  • Set the Number Rating Icons
  • All Props are Reactive
  • Keyboard Shortcuts
  • Built in User Accesability
  • Handles Null values

How to istall

npm i svelt-rating-selector-display

How to use

How to get ratings

<script>
	import { RatingSelector } from 'svelte-rating-selector-display';
	let rating = Null; // This will be updated when a user selects a rating
</script>

<RatingSelector bind:rating enableSelection={true} />

How to display ratings

<script>
	import { RatingSelector } from 'svelte-rating-selector-display';
</script>

<RatingSelector rating={3.35} />

Props

| Prop | Type | Description | Default Value | | :---------------- | :---------------------------- | :------------------------------------------------------------------------------- | :------------ | | rating | number | null | Inital displayed rating, if null no rating is displayed | null | | enableSelection | boolean | null | If true the user can select a rating, if false a static rating will be displayed | false | | numberOfIcons | number | null | The number of icons to display for the rating | 5 | | style | [key: string]: string | null | A list of styles to be applied to the parent element of the selector | null |

If null is passed in for a prop, it will be set as the default value.

How to format

CSS variables

| Colors: | Default Value | Description | | :------------------------------ | :------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------ | | --icon-selected-color | #ffd700 #ffd700 | Color of rating icons when they are selected | | --icon-unselected-hover-color | #ccc #ccc | Color of rating icons when they are not selected | | --icon-selected-hover-color | #f9dd39 #f9dd39 | Color of rating icons when they are selcted and hovered over | | --icon-unslected-color | #f9e053b1 #f9e053b1 | Color of rating icons when they are unslected and hovered over | | --focused-stroke-color | #ffffff #ffffff | Color of stroke around rating icon when it is focused. This is for keyboard use, and user accessibility |

| Formating: | Default Value | Description | | :---------------------- | :------------ | :----------------------------------------------------------------------------------------------------- | | --icon-size | 3.5rem | Size of the rating icons | | --icon-spacing | 0rem | Space between rating icons | | --selector-icon | | Icon to be desplayed | | --focused-stroke-size | 3px | Size of stroke around rating icon when it is focused. This is for keyboard use, and user accessibility |

example:

:root {
	--icon-selected-color: #211b27;
	--icon-unselected-hover-color: #948f97;
	--selector-icon: '☆';
}

Using style prop

<script>
	import { RatingSelector } from 'svelte-rating-selector-display';
	const style = {
		'--icon-selected-color': '#211B27',
		'--icon-unselected-color': '#948F97',
		'--selector-icon': JSON.stringify('☆'), // Note: --selection-icon must be stringified
	};
</script>

<RatingSelector rating={3.7} {style} />