Skip to content

    Browse components

    Peekaboo Stars

    Star rating with a little character that peeks over the card, rising and grinning wider the higher you hover. Arrow keys, Home/End and digits work too.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/peekaboo-stars

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/peekaboo-stars.json

    Usage

    import { PeekabooStars } from "@/components/ui/peekaboo-stars";
    
    const [stars, setStars] = useState(0);
    
    <PeekabooStars value={stars} onChange={setStars} />

    Props

    PropTypeDefaultDescription
    defaultValuenumber0Initial rating when uncontrolled.
    maxnumber5Number of stars.
    colorstring"#facc15"Star fill color.
    characterColorstring"#fb923c"Color of the peeking character.
    labelstring"Rating"Accessible name of the rating.
    labelsstring[]["Awful","Meh","Okay","Good","Love it!"]One word per rating step.
    valueReactNode—Controlled rating, pair with onChange.
    onChangeReactNode—Called with the new rating.
    classNamestring—Extra classes for the root element.