Rating
Star rating input
UI PrimitiveForm Inputs
Overview
Renders a row of rating items. Supports three display modes, half-precision for stars, hover preview, and read-only display.
Usage
import { Rating } from "@leanicon/web-builder-library";Controlled:
const [value, setValue] = React.useState(0);
<Rating value={value} onValueChange={setValue} />;Variants
Star rating (default)
Half-precision stars
Emoji mode
Numeric mode
Read-only
Notes
- Star color uses
--color-ratingCSS variable; set this in your theme. - Emoji defaults: 😡 😕 😐 🙂 😍 (for 5-point scale).
- Dark mode is handled via semantic tokens.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
value | number | — | No | |
onValueChange | ((value: number) => void) | — | No | |
max | number | 5 | No | |
precision | enum | full | No | |
readOnly | boolean | false | No | |
disabled | boolean | false | No | |
className | string | — | No | |
mode | "numeric" | "star" | "emoji" | null | star | No |