Docyrus

Rating

Star rating input with half-star support and custom icon rendering.

iOSAndroid
Preview Rating on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-rating
Required Packages(1 package)
pnpm add react-native-reanimated

Usage

import { Rating } from '@/components/docyrus-native/rating';

<Rating value={3} onChange={(v) => console.log(v)} />
<Rating value={3.5} allowHalf showValue readonly />
<Rating value={4} max={10} size="lg" />

API Reference

PropTypeDefaultDescription
valuenumber0Current rating value
onChange(value: number) => void—Callback when rating changes
maxnumber5Maximum number of stars
size'sm' | 'md' | 'lg''md'Star size
readonlybooleanfalseWhether the rating is read-only
disabledbooleanfalseWhether the rating is disabled
allowHalfbooleanfalseEnable half-star ratings
showValuebooleanfalseShow numeric value next to stars
colorstring'#fbbf24'Fill color for active stars
emptyColorstring—Color for empty stars (defaults to theme mutedForeground)
renderIcon(props: { filled: boolean; half: boolean; color: string; size: number }) => ReactNode—Custom icon render function
classNamestring—Additional CSS classes
accessibilityLabelstring'Rating'Accessibility label

Type Exports

TypeDescription
RatingPropsProps for Rating component
RatingSize'sm' | 'md' | 'lg'

On this page