ui-kit0.0

Forms

Rating

Capture a quick opinion with stars.

Basic

Hover to preview, click to choose. The chosen star pops slightly. Underneath are native radio inputs, so it works in forms and with the arrow keys.

How was your stay at Harbour House?

When to use

  • A quick opinion on a product, stay, article or support chat.
  • Showing an average score next to a review count (read-only).
  • Not for precise measurements (use a slider) or when you need written feedback (add a textarea).

Half steps

allowHalf splits every star into two halves: the left half picks .5. Values step by 0.5.

3.5 / 5

Read-only

readOnly turns the stars into an image with a text alternative and shows fractional values: 4.3 fills 30% of the fifth star.

  • Aurora desk lamp4.3 (218)
  • Fjord wool throw4.8 (1042)
  • Slate ceramic mug3.6 (87)

In a form

Give it a name: the checked radio submits its value with the form. required works natively.

Service
Speed

API

Rating

PropTypeDefaultDescription
value / defaultValuenumber0Current rating. 0 means none.
onValueChange(value: number) => void—Called when the rating changes.
maxnumber5Number of stars.
allowHalfboolean—Half-star steps.
allowClearboolean—Clicking the chosen star again, or Backspace/Delete, clears it.
readOnlyboolean—Display only; supports fractional values.
disabledboolean—Not interactive, dimmed.
size'sm' | 'md' | 'lg''md'Star size 16 / 24 / 32px.
name / requiredstring / boolean—Form field name and native required.
aria-labelstring'Rating'Name of the group.

Keyboard

KeyAction
TabMoves focus to the rating (the chosen star, else the first).
Arrow keysChoose the previous / next value (native radio behaviour; 0.5 steps with allowHalf).
Backspace / DeleteClear the rating (when allowClear).

Accessibility

  • A radiogroup of native radio inputs, each named “3 stars”, “2.5 stars”.
  • Read-only ratings are role="img" with a label like “Rating: 4.3 out of 5”.
  • Stars have an amber fill and a darker amber outline, so they stay visible on light and dark surfaces.
  • Keyboard focus shows a ring around the star.

Motion

  • Hovering previews the value instantly; the fill tracks in 150ms.
  • The chosen star pops from .72 to 1 on the snappy spring.
  • Reduced motion: no pop; fills still change.