Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-rating.json --yes

Rating

Pro

A row of stars to give a score, or to show an average with halves, for reviews and feedback, for React and Tailwind CSS. Part of Goop Pro.

Click a star (its start half for a half with half stars on), or Tab in and use the arrows, Home, End or a number key; Backspace clears. Look puts the stars in a form’s field, an average in a card’s line (Size sm as a card shows it), or a row beside Send and a filter. Switch the sizes, the value words, read-only, disabled and invalid. The score is kept in the page only: nothing is sent, and the filter beside it filters nothing.

When to use

  • A row of stars to give a score, or to show an average with halves, for reviews and feedback.
  • Also called: star rating.

Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Rating on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-rating.json --yes
PROMPT
Add the Goop Rating to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { Rating } from '@/components/ui/goop/rating';
import { Field } from '@/components/ui/goop/field';

<>
  <Field orientation="vertical" label="How did we do?">
    <Rating name="score" />
  </Field>
  <Field orientation="vertical" label="Your review">
    <Rating name="review" size="lg" allowHalf valueLabels />
  </Field>
  <Rating readOnly size="sm" value={4.5} count={128} />
</>
  • Fits: record, list: row.
  • Also known as: StarRating, Stars, ReviewScore, ScoreInput, RatingInput.
  • Ask for a 1-to-5 score with Rating inside a vertical Field and show an average with Rating readOnly size sm; use Slider for continuous values and RadioGroup for named options.
  • height, width, gap, corner, text: add no class for these.

API reference

  • Each option with its sentence: rating--options.md
  • State: value (value / defaultValue / onValueChange); drawn by data-disabled
  • data-slot values (to select a part by): rating, rating-half, rating-icon, rating-indicator, rating-item, rating-list, rating-radio, rating-value

Rating: every option

TSX
import { Rating } from '@/components/ui/goop/rating';

Options

  • value?: number — The chosen score, 0 for not rated (with onValueChange); read-only, the average.
  • defaultValue?: number = 0 — The score at first render, for a rating that holds its own.
  • onValueChange?: (value: number) => void — Called with the new score, or 0 when cleared.
  • max?: number = 5 — How many stars.
  • readOnly?: boolean = false — Show the value only: one image named "Rated 4.5 out of 5", halves drawn, no tab stop.
  • size?: 'sm' | 'md' | 'lg' = 'md' — md: 20 px stars in 28 px cells; sm: 14 px stars, read-only beside 12 px words; lg: 24 px stars in 32 px cells, a rating that is the page's question.
  • allowHalf?: boolean = false — Half stars may be given: the pointer on a star's start half gives the half, the arrows move by a half.
  • optional?: boolean = true — The score may be none: a second press on the chosen star, Backspace or Delete clears it.
  • name?: string — The radios' name, sent with the form (nothing while not rated).
  • disabled?: boolean = false — Every star off and dimmed: none takes the focus, a press or a key.
  • label?: string — The rating's name where no Field label and no aria-label names it.
  • starLabel?: (value: number, max: number) => string — Each star's name for a reader ("1 star", "n stars" by default).
  • valueLabels?: boolean | readonly string[] — Words for the scores, shown after the stars in place of the number: true for "Poor", "Fair", "Good", "Very good", "Excellent" (five stars), or one word per star.
  • showValue?: boolean = true — Whether the value stands after the stars: the score ("4", "4.5") or its word; at 0 an en dash named empty (read-only, empty itself).
  • empty?: string = 'Not rated' — The words for not rated: interactive, the name of the en dash shown in their place; read-only, shown after the stars.
  • count?: number — Read-only: how many ratings the average holds ("4.5 (128)").
  • State: value (value / defaultValue / onValueChange); drawn by data-disabled

Keyboard

KeyWhat it does
TabMove to the chosen star (the first when not rated), then out of the group
ArrowRight ArrowUpChoose the next star (the next half with allowHalf), wrapping
ArrowLeft ArrowDownChoose the previous star (the previous half with allowHalf), wrapping
SpaceChoose the focused star
Home EndChoose the lowest score (one star, or a half with allowHalf) or the highest, the focus with it
1-9Choose that many stars, the focus with it (a number past the stars does nothing)
Backspace DeleteClear the score

Accessibility

  • The native element answers the keyboard.

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
disabledthe attribute data-disabled
invalidthe attribute aria-invalid

Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

goop.so/themes/trail/components/rating.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-rating.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.