byDefaultHuman
Components

Rating

A hand-drawn star rating with hover fill and hachure.

Installation

package manager
npx shadcn add https://bydefaulthuman.fun/r/rating.json

Props

PropTypeDefaultDescription
className
string
Additional Tailwind classes applied to the component.
defaultValue
number
0
Initial uncontrolled value.
disabled
boolean
Disables interaction.
id
string
Optional stable id used for sketch seeding and accessibility.
label
string
Optional label text shown with the component.
max
number
5
Upper bound for the value.
onChange
(value: number) => void
Callback fired when the value changes.
size
number
24
Controls the visual size of the component.
theme
CrumbleTheme
Overrides the global Crumble theme for this instance.
value
number
Controlled value for the component.

Sizes

Read only

Disabled

Accessibility

Rating uses button elements for each star, so keyboard focus still works. Pair the stars with a visible label or nearby text so the scale meaning is clear before a user selects a value.

Examples

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

<Rating defaultValue={3} />;