Skip to content
Dumb UI

Search Dumb UI

Jump to a page or component, or switch the style

Search Dumb UI

Jump to a page or component, or switch the style

Rating

Star rating on a radio group: arrow keys, hover preview, and a read-only display mode.

OriginalsDumb extras
How useful were these docs?
Great
4.0 from 1,284 reviews
$ pnpm dlx shadcn@latest add @dumb/rating

Needs the @dumb registry in components.json and the style tokens. See Installation.

import { Rating } from "@/components/ui/rating"
<Rating defaultValue={4} aria-label="Rate this article" />

API reference

Props marked “extra” are Dumb UI additions. Everything else matches shadcn/ui.

Rating

PropTypeDefault
value / defaultValueextranumber

Controlled or initial rating.

-
onValueChangeextra(value: number) => void

Called when the rating changes.

-
maxextranumber

Number of stars.

5
readOnlyextraboolean

Static display, announced as Rated x out of y.

false
sizeextra"sm" | "default" | "lg"

Star size.

"default"
ArrowLeftArrowRight
Changes the rating.