Kinetik UI

Star Rating

.md

Stars you tap or drag across; the fill sweeps from star to star and each one swells as it fills.

v1.0.0Live on web@shopify/react-native-skiareact-native-gesture-handlerreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add star-rating

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/star-rating.json

Install manually

  1. Install dependencies
    npx expo install @shopify/react-native-skia react-native-gesture-handler react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/star-rating.tsx
    View source files

Usage

import { StarRating } from '@/components/kinetik/star-rating';

<StarRating accessibilityLabel="Your rating" value={rating} onValueChange={setRating} />

// Read-only, with half stars
<StarRating accessibilityLabel="Average rating" value={4.5} allowHalf size={14} />

Leave out onValueChange for a read-only rating. Tap a star to rate up to it, or drag across the row; tapping the current rating again clears it unless clearable={false}.

When to use

  • Asking for a quick rating after a stay, a ride, an order or an episode.
  • Showing an average rating beside a listing, read-only.

When not to use

  • Scales that need words at each step (disagree to agree). Use labelled options.
  • Precise scores. Use a stepper or a slider.

Notes

  • All the stars share one Skia canvas; the fill and the swell are driven by two shared values, so a rating in every row of a list stays light.
  • With allowHalf the left half of a star rates a half.
  • With reduced motion the stars fill at once.

Props

StarRatingProps

PropTypeDefaultDescription
valuerequirednumber—
onValueChange(value: number) => void—Leave unset for a read-only rating.
maxnumber5Number of stars. Defaults to 5.
allowHalfbooleanfalseAllow half stars. Defaults to false.
clearablebooleantrueTapping the current rating clears it. Defaults to true.
sizenumber32Width of one star. Defaults to 32.
colorstring—Fill colour. Defaults to the theme azure.
accessibilityLabelstring'Rating'What is rated, read before the value, e.g. "Your rating". Defaults to 'Rating'.
hapticsbooleantrueA tick for each star crossed. Defaults to true.
disabledbooleanfalse
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
One small Skia canvas for all the stars, driven by two shared values. Nothing runs at rest.
Measured

Pixel 9 emulator, API 35, release build · interaction median 1.00× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 152 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
The stars fill at once, without the sweep or the swell.
Screen readers
An adjustable value ("3 of 5 stars") with increment and decrement actions; read-only ratings are a single image with the value in its name.
Touch target
The row of stars is the target and at least 44 pt tall; each star is as wide as `size` plus the gap.

Source files

components/kinetik/star-rating.tsx is in the Code tab of the preview above.