Skip to content
Eskais UI

Forms

Rating

UI SDK Rating styled as stars that fill to the score: half stars, averages that fill part of a star, a pointer preview, sizes and 44px stars on touch screens.

Example

Installation

npx shadcn@latest add @eskais/rating
npm packageslucide-react

Usage

Import
import { createRatingController, Rating, RatingItem } from "@/components/ui/rating"

API reference

Rating

PropTypeDefault
size"sm" | "md" | "lg""md"
iconThe icon of each star, drawn twice: an outline, and a filled copy clipped to how much of the star is covered.ComponentType<SVGProps<SVGSVGElement>>StarIcon

Also takes every prop of UI SDK Rating.

RatingItem

PropTypeDefault
iconComponentType<SVGProps<SVGSVGElement>>StarIcon

Also takes every prop of UI SDK RatingItem.

Other exports

createRatingControllertype RatingItemPropstype RatingPropstype RatingSizetype RatingControllertype RatingItemStatetype RatingStatetype RatingValueChangeReason

Accessibility

  • A radio group: arrow keys change the score, Space checks the focused star; each score is a radio named like "3 stars".
  • Stars fill in the warning colour over an input-strong outline, so the score shows by shape and fill, not hue alone.
  • Read-only, it is one image named by getValueLabel.

Agent actions

Agents find it by its label and set a score with setValue.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.