Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
thy-star-rating
Advanced tools
This is a simple star-rating web-component built with lit. It has a "value" attribute to set the initial value declarative.
This is a simple star-rating web-component built with lit. It has a "value" attribute to set the initial value declarative.
<thy-star-rating></thy-star-rating>
<thy-star-rating readonly></thy-star-rating> //readonly
<thy-star-rating disabled></thy-star-rating> //disabled
<thy-star-rating value="2"></thy-star-rating> // sets the initial Rating to 2 stars
It also fires a custom event "changed" when the rating is changed, that you can listen to like so:
const els = document.querySelectorAll('thy-star-rating');
els.forEach((el, idx) => {
el.addEventListener('changed', (e) => {
console.log(`Component ${idx + 1}: Rating changed from ${e.detail.oldValue} 🡒 ${e.detail.value}`);
});
});
npm install thy-star-rating
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My fancy app</title>
<script type="module">import 'thy-star-rating';</script>
</head>
<body>
<thy-star-rating></thy-star-rating>
</body>
</html>
name | type | default-value |
---|---|---|
value | number (0-5) | 0 |
readonly | boolean | false |
disabled | boolean | false |
Overwrite colors with this css vars:
default | hover | clicked | disabled |
---|---|---|---|
--star-default-color | --star-halo-color | --star-rated-color | --star-disabled-color |
FAQs
This is a simple star-rating web-component built with lit. It has a "value" attribute to set the initial value declarative.
The npm package thy-star-rating receives a total of 1 weekly downloads. As such, thy-star-rating popularity was classified as not popular.
We found that thy-star-rating demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.