Skip to content

Rating

A star rating you can choose with a mouse, touch or arrow keys.

Live — this one is real

How useful was this?

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.

Open full source ↗

Props

PropTypeDefaultDescription
value / onValueChangenumber / function—Controlled selected score.
maxnumber5One 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.

Works alongside