Rating
A star rating you can choose with a mouse, touch or arrow keys.
Live — this one is real
Usage
import { useState } from "react";
import { Rating } from "mizu-ui";
export function Example() {
const [value, setValue] = useState(3);
return (
<Rating
label="How useful was this?"
value={value}
onValueChange={setValue}
/>
);
}
Source & setup
Import mizu-ui/styles.css once. Fonts are optional via mizu-ui/fonts.css. Override --mizu-* tokens or use className for local styling. Uses native React and CSS; install the package peers for root imports.
Inspect forms/Selection.tsx
Source is included in the npm package under src/forms/Selection.tsx.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value / onValueChange | number / function | — | Controlled selected score. |
| max | number | 5 | One to ten stars. |
Accessibility
Native radio choices announce each score and support arrow keys. Decoration is hidden from readers.
Motion
CSS transitions explain state changes. Reduced motion removes travel.