Skip to content
shadcn.io
shadcn.io is not affiliated with official shadcn/ui

Shadcn Rating for React and Tailwind

Show reviews and ratings in a visual format.

VV

Vinicius Vicentini

Tuestday morning at Mercado N.89

Rate your driver

Installation

bunx --bun shadcn@latest add https://kit.dev/r/rating.json

Usage

import { RatingGroup } from "@/components/ui/rating";
<RatingGroup />

Controlled

Use value and onValueChange to control the rating programmatically.

States

Readonly

Use the readOnly prop to display a rating without interaction.

Disabled

Use the disabled prop to prevent interaction and show a disabled state.

Examples

Half star

Use allowHalf to allow half-star selections.

Count

Use the count prop to show more or less stars.

Testimonial

Display a read-only rating inside a testimonial card.

Customize size

Use the className prop to set the size of the rating.

Custom icon

Compose the rating with a different icon.

Custom color

Override the filled color with className.

API Reference

Rating

Root component.

PropTypeDefault
allowHalfbooleanfalse
countnumber5
defaultValuenumber-
valuenumber-
onValueChange(details: ValueChangeDetails) => void-
readOnlyboolean-
disabledboolean-
classNamestring-

For a complete list of props, see the Ark UI documentation.