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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@loomidev/rating

v0.3.0

Published

<loomi-rating> — a star/heart/thumbsup rating control (form-associated).

Readme

@loomidev/rating

<loomi-rating> — a 0–5 rating control as stars, hearts or thumbs-up. Form-associated: submits the rating under name.

npm install @loomidev/rating lit
import "@loomidev/rating";

Basic Usage

<loomi-rating name="star-rating"></loomi-rating>
<loomi-rating type="heart" name="heart-rating"></loomi-rating>
<loomi-rating type="thumbsup" name="thumb-rating"></loomi-rating>

Where there are multiple ratings on the same page, give each a unique name.

Different Colors

Any loomi color works — the default is orange.

<loomi-rating rating="1" color="error" name="error-rating"></loomi-rating>
<loomi-rating rating="2" color="yellow" name="yellow-rating"></loomi-rating>
<loomi-rating rating="3" color="success" name="success-rating"></loomi-rating>
<loomi-rating rating="4" color="primary" name="primary-rating"></loomi-rating>
<loomi-rating rating="5" color="error" name="error-rating"></loomi-rating>
<loomi-rating rating="3" color="success" name="success-rating"></loomi-rating>
<loomi-rating rating="4" color="success" name="violet-rating"></loomi-rating>
<loomi-rating rating="4" color="primary" name="indigo-rating"></loomi-rating>

Different Sizes

<loomi-rating rating="2" size="small" name="small-rating"></loomi-rating>
<loomi-rating rating="3" size="medium" type="thumbsup" name="medium-rating"></loomi-rating>
<loomi-rating rating="2" size="big" type="heart" name="big-rating"></loomi-rating>

Reacting to a Rating

<loomi-rating rating="2" name="album-rating"></loomi-rating>

<script type="module">
  document.querySelector('loomi-rating[name="album-rating"]').addEventListener("change", (e) => {
    console.log(e.detail.rating); // 1–5
    saveRating(e.detail.rating);
  });
</script>

Disabled / Read-Only Ratings

Not every rating needs to be interactive — display a rating the user already gave as read-only by setting clickable="false".

<loomi-rating rating="4" clickable="false"></loomi-rating>

Form Submission

<loomi-rating name="album_rating" rating="3"></loomi-rating>
new FormData(form).get("album_rating"); // "3"

Accessibility

For the library-wide baseline, see Foundations — Accessibility.

Responsive behavior

For the shared container and viewport rules, see Foundations — Responsive behavior.

Dark mode

For theme activation, token overrides, and contrast guidance, see Foundations — Dark mode.

Attributes

| Attribute | Default | Description | | ----------- | --------- | -------------------------------------- | | name | (blank) | Submitted with the form. | | rating | 0 | Current rating (0–5). | | type | star | star | heart | thumbsup | | color | warning | Any loomi color. | | size | small | small | medium | big | | clickable | true | Allow changing the rating. (boolean) |

Events

| Event | Description | | -------- | --------------------------------------------- | | change | Fired when the value is committed or changed. |

Full Example

<loomi-rating
  type="heart"
  name="album-rating"
  rating="3"
  color="yellow"
  size="big"
></loomi-rating>

Framework integration

<loomi-rating> is a standard custom element, so the browser can use it in plain HTML, Blade, React, Vue, Angular, Svelte, Astro, and most other frameworks. The important beginner rule is: install the package, import it once before the tag is rendered, then write the Loomi tag in your template.

Where to run commands

Run install commands from the app where you want to use this component. That means the folder that contains that app's package.json. Do not run these install commands from packages/rating unless you are editing LoomiUI itself.

cd /path/to/your-app
npm install @loomidev/rating lit

If you are contributing to LoomiUI itself, first move to the top-level components folder. That is where the main package.json for all packages lives, and pnpm --filter ... commands should be run from there:

cd /path/to/your-copy-of-loomiui/components
pnpm --filter @loomidev/rating build
pnpm --filter @loomidev/rating typecheck

Choose your framework

Use the CDN version for prototypes, documentation pages, or a quick reproduction. The import map tells the browser where to find Lit, which Loomi components use internally.

<script type="importmap">
  { "imports": { "lit": "https://esm.sh/[email protected]", "lit/": "https://esm.sh/[email protected]/" } }
</script>
<script type="module" src="https://esm.sh/@loomidev/rating"></script>

<loomi-rating name="satisfaction" rating="4" clickable></loomi-rating>

In Vite, Webpack, Parcel, Rollup, or a framework build pipeline, install the package and import it once in your main app JavaScript file. After that, you can use the Loomi tag anywhere in your app.

import "@loomidev/rating";

Because this is a form-capable component, give it a name when it should submit with a native <form>. Read its value with new FormData(form).get("the-name") just like you would for a built-in input.

Run the install command from your Laravel project root, then import the component in resources/js/app.js. If your project uses Laravel Vite, npm run dev and npm run build should also be run from the Laravel project root.

cd /path/to/your-laravel-app
npm install @loomidev/rating lit
npm run dev
// resources/js/app.js
import "@loomidev/rating";
<loomi-rating name="satisfaction" rating="4" clickable></loomi-rating>

React can render Loomi tags directly. If you are on React 18, or if you need to pass arrays, objects, or functions, use a ref and assign those values after the component mounts.

import "@loomidev/rating";

export function LoomiExample() {
  return (
    <loomi-rating name="satisfaction" rating="4" clickable></loomi-rating>
  );
}

If TypeScript does not recognize the Loomi tag in JSX, add it to your app's JSX type declarations.

Import the package in the component that uses it, or once in your main Vue file. Vue templates can use Loomi tags directly. For arrays, objects, or functions, pass the value as a JavaScript property instead of as plain text.

<script setup>
import "@loomidev/rating";
</script>

<template>
  <loomi-rating name="satisfaction" rating="4" clickable></loomi-rating>
</template>

If Vue warns that the tag is an unknown component, configure compilerOptions.isCustomElement for tags that start with loomi- in your Vite or Vue config.

Import the package once and tell Angular to allow custom HTML tags with CUSTOM_ELEMENTS_SCHEMA. For NgModule apps, add the schema to the module instead of the standalone component.

// app.component.ts
import { CUSTOM_ELEMENTS_SCHEMA, Component } from "@angular/core";
import "@loomidev/rating";

@Component({
  selector: "app-root",
  standalone: true,
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <loomi-rating name="satisfaction" rating="4" clickable></loomi-rating>
  `,
})
export class AppComponent {}

Svelte can import the package inside a component script. Astro can import it in the frontmatter of the page or layout where the tag appears.

<script>
  import "@loomidev/rating";
</script>

<loomi-rating name="satisfaction" rating="4" clickable></loomi-rating>
---
import "@loomidev/rating";
---

<loomi-rating name="satisfaction" rating="4" clickable></loomi-rating>

Server-side rendering notes

Frameworks such as Next.js, Nuxt, SvelteKit, and Astro sometimes render HTML on the server before browser-only code runs. If your framework complains, move the Loomi import to client-side code. In Next.js, that usually means a component with "use client"; in Nuxt, it often means a .client.ts plugin.

Dependencies

  • @loomidev/core