StarRating

Hover previews, click sets. Stars pop in a wave. Inputs.

Open playground

About

StarRating is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { StarRating } from "@ashutoshswamy/smoui" and set count, defaultValue, size among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { StarRating } from "@ashutoshswamy/smoui";

<StarRating defaultValue={3} onChange={(n) => save(n)} />

Props 4

count

Number of stars.

numberdefault 5
defaultValue

Initial rating.

numberdefault 0
size

Star size in px.

numberdefault 28
onChange

Called when a rating is picked.

(value: number) => void