Skip to contentKino
Skip to Content

Rating

Pick a score out of five stars, in whole or half stars. The fill wipes along the row from the old score to the new one.

npx shadcn add https://kinoui.com/r/rating.json
Share on

Examples

Rate your conversation

Billing question · closed today at 14:32
MC
Maya ChenSupport · answered in 4 minutes

How did Maya do?

Default

Point at the stars to preview a score, and click to pick it. In a <form>, name sends the score; invalid colours the stars until one is picked.

Onboarding call

With Lucía Fernández · Tuesday, 30 minutes

How useful was it?

3.5 / 5

Half stars

Set step={0.5}: the first half of a star picks the half. The arrow keys move by a half.

Reviews

Kino for teams
4.3
1,284 reviews
Priya Raman
Head of Ops, Kestrel2 days ago

Cycles finally match how we plan. The weekly digest replaced two meetings.

Tomás Alvarez
Engineer, HalyardLast week

Fast, and the keyboard shortcuts are everywhere. I miss a timeline view.

Kenji Watanabe
Founder, Tidewater3 weeks ago

Good for one team. Permissions across three teams took us an afternoon.

Read only

Set readOnly to show a score, such as an average: any fraction is drawn, and a screen reader reads it as one image.

Quarterly survey

Kino · 2 of 4 questions

How likely are you to recommend Kino, out of 10?

Max

Set max for another number of stars. In a narrow column the stars share its width.

Your score for the March release

Scores close a week after a release.

Disabled

A disabled rating fades and can’t be changed. Say why beside it.

Installation

npx shadcn@latest add https://kinoui.com/r/rating.json
Files
lib/reduce-motion.tslib/resize.tslib/choice.tslib/controllable.tscomponents/kino/rating.tsx
Packages
@base-ui/react

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

Props

PropTypeDefaultDescription
valuenumbernullNoneThe picked score, when you hold the state.
defaultValuenumbernullnullThe score picked at first, when it holds its own state.
onValueChange(value, details) => voidNoneCalled with the new score when another is picked.
maxnumber5How many stars.
step10.510.5 lets a person pick half a star.
readOnlybooleanfalseShows the score as an image, with any fraction drawn, and takes no input.
disabledbooleanfalseFades the stars and takes no input.
namestringNoneThe field’s name when the rating is in a <form>.
requiredbooleanfalseThe form can’t be sent until a score is picked.
aria-invalidbooleanNoneDraws the empty stars in the destructive colour.
getAriaLabel(value, max) => string`${value} out of ${max} stars`Names each score’s radio, and the score a read-only rating shows. Pass one to translate it.

Data attributes

AttributeOnDescription
data-disabledRatingPresent while it is disabled.
data-readonlyRatingPresent when it only shows a score.

CSS variables

VariableSet it onDefaultDescription
--rating-starRating, or <body>1.25remHow large each star is. Its cell, the target a pointer aims at, is the density’s smallest control height.

Accessibility

  • It follows the radio group pattern: Tab moves into the row at the picked score, and the arrow keys move the pick, by a half with step={0.5}.
  • Name it with aria-label, or with aria-labelledby pointing at its question. Each score is named "3.5 out of 5 stars"; pass getAriaLabel to word it another way.
  • A pointer aims at a whole star, at least 24px, and with half steps its first half picks the half, as a slider’s track does.
  • A picked star is filled and an empty one is an outline, so the score never relies on colour. In forced colours the filled stars take the system highlight.
  • Read only, it is one image named with its score, such as "4.3 out of 5 stars".
  • When the system asks for less motion, the fill moves at once and a held star doesn’t shrink.