Code
In context
Install · Free Web Component
One file, no dependencies. Solar preset, every other option included. Host it yourself so your visitors never load anything from our servers.
The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:
Pro · React + TypeScript Pro
One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.
- React component (controlled or uncontrolled) with TypeScript types and the full source
- Aurora, Mint and Mono tints, plus your own three colours as a custom tint
- The vanilla Web Component with every tint, a demo page, README and license
Attributes & props
| Name | Type | Default | Description |
|---|---|---|---|
| value | number | 0 | The rating. Fires change with detail.value. Tapping the current rating again clears it to 0. |
| max | number | 5 | Number of stars (1–10). |
| step | 1 | 0.5 | 1 | Whole stars or halves. |
| size | number (px) | 34 | Star size; the gap scales with it. |
| readonly | boolean | off | Shows a score and ignores input. Any fraction works here: 4.3 fills 30% of the fifth star. readOnly in React. |
| disabled | boolean | off | Dims it and ignores input. |
| theme | 'light' | 'dark' | 'light' | Empty stars pressed into a light or a dark surface. |
| label | string | 'Rating' | Accessible name. aria-label in React. |
| sound | boolean | off | A glass clink, higher for a higher rating (plus a tap of vibration on phones). Also on for everything inside an element with data-ui-sound="on". |
| tint Pro | 'solar' | 'aurora' | 'mint' | 'mono' | object | 'solar' | Colours across the row, or a custom { colors: [a, b, c] }. Free build ships Solar only. |
On a phone you can tap a star or drag across the row and lift. From the keyboard the arrow keys change the rating by one step, Home clears it, End gives the maximum and the digit keys set it directly. The stars are CSS masks and the sparks are a handful of short-lived elements — no canvas, no WebGL — so dozens of read-only ratings in a list are fine. Reduced motion keeps the fill and drops the hop and the sparks.
More components
- Tide Slide
- Pearl Code
- Pearl Dial
- Pearl Check
- Pearl Input
- Pearl Select
- Pearl Accordion
- Pearl Calendar
- Pearl Chip
- Glass Dock
- Pearl Slider
- Pearl Segmented
- Aurora Ring
- Glass Toggle
- Pearl Loader
- Ink Sphere
- Frost Card
- Holo Card
- Stream Text
- Lens Compare
- Glass Toast
- Glass Sheet
- Glass Tip
- Glass Nav
- Pearl Tabs
- Glass Command
- Halo Avatar
- Pearl Steps
- Pearl Skeleton
- Pearl Table
- Pearl Empty
- Roll Counter
- Glass Marquee
- Reveal Text
- Mesh Gradient
- Silk Waves
- Dot Field
- Plasma Orb
- Voice Wave
- Plush Buddy
- Gummy Agent
- Glass Tabbar
- Glass Menu
- Pearl Pricing
- Glass Bento
- Quote Wall
- Glass Cta
- Magnet Button
- Beam Border
- Spotlight Card
- Scratch Reveal
- Glass Sidebar
- Pearl Pagination
- Pearl Breadcrumb
- Liquid Metal Button
- Mercury Orb
- Prompt Input
- Voice Orb
- Firefly Button
- Pearl Button
- Alien Face
- Prism Button
- Liquid Carousel
- Orbit Carousel
- Deck Carousel