Rating

Visual star feedback indicator with support for hover selection, read-only stats, and customizable scale sizes.

Preview & Interactive Laboratory

Interactive Selection

Sizes & Read-Only

Custom Upper Threshold (max=10)

Usage & Implementation

import { Rating } from "@/components/ui/rating"

const [value, setValue] = React.useState(4);

<Rating 
  value={value} 
  onValueChange={setValue} 
  size={24} 
/>
React / Tailwind

Granular Customization

1

Star Shell

The grid container holding star vectors.

className={`className`}
2

Star Count

Change maximum count threshold from standard scale.

className={`max={10}`}
3

Action Mode

Bind callbacks to persist selected indexes.

className={`onValueChange={(val) => ...}`}

API Reference (Props)

PropTypeDefaultDescription
valuenumberundefinedCurrent rating selected value index.
maxnumber5Maximum threshold bound of stars.
readOnlybooleanfalseDisables click events and hover animations.
sizenumber16Star size in pixels.