# Rating — React Native component for Expo

> Drag across the stars to rate; the top one throws a little spark burst.

Star or heart rating you can tap or drag across (touch and mouse), with half-star precision. Icons fill smoothly, pop in a quick stagger with a wobble, and the top one throws a spark burst; read-only mode renders any fraction.

- Docs: https://expokit.in/docs/components/rating
- Tier: Pro (ExpoKit Pro plan)
- Also called: star rating, rating bar, review stars
- Category: Selection
- Platforms: iOS, Android, web
- Expo Go: yes, no development build needed
- npm dependencies: react-native-svg, expo-haptics
- Uses ExpoKit items: kit
- Variants: Default, Half Stars, Hearts, Read Only, Sizes

## Installation

This component is part of ExpoKit Pro. With a Pro plan, log the CLI in once and add it like any other item:

```bash
npx @expokit/cli@latest login
```

Plans: https://expokit.in/pricing

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value / onValueChange` | `number` | — | Controlled value (or use defaultValue). |
| `defaultValue` | `number` | `0` | Initial value when uncontrolled. |
| `max` | `number` | `5` | Number of icons. |
| `allowHalf` | `boolean` | `false` | Half-icon precision when tapping or dragging. |
| `readOnly` | `boolean` | `false` | Display only; fractional values (4.3) fill partially. |
| `clearable` | `boolean` | `false` | Tap the current value again to reset to 0. |
| `icon` | `"star" \| "heart"` | `"star"` | Star or heart icons; heart switches the default fill to danger. |
| `size` | `"sm" \| "md" \| "lg" \| number` | `"md"` | 18 / 28 / 40pt, or any number. |
| `accent` | `string` | `warning / danger` | Fill colour. |
| `gap` | `number` | `20% of size` | Space between icons. |
| `haptics` | `boolean` | `true` | Selection tick for every step while tapping or dragging. |
| `disabled` | `boolean` | `false` | Dims and blocks input. |
| `style` | `StyleProp<ViewStyle>` | — | Style for the row of icons. |
| `className` | `string` | — | Tailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides. |

## Behaviour & accessibility

- **Touch**: Tap or drag across the row to set the value, to half-icon precision with allowHalf. With clearable, tapping the current value clears it.
- **Motion**: Icons fill smoothly and pop in a quick stagger with a wobble. When you raise the rating, the top icon throws a spark burst.
- **Haptics**: A selection tick plays for every step while tapping or dragging.
- **Screen readers**: One adjustable element read as 'N of 5'. Swipe up or down to change it by one step.
- **Web**: Works with the mouse too, and shows a pointer cursor while interactive.

## FAQ

### How do I make a star rating in React Native?

Use ExpoKit's Rating, a Pro component: with ExpoKit Pro, the ExpoKit CLI copies a ready-made star rating into your Expo or React Native app as plain TypeScript you can edit. It works on iOS, Android and web, and in Expo Go.

### Does Rating work in Expo Go?

Yes. Rating runs in Expo Go on iOS and Android with no development build — its packages (react-native-svg, expo-haptics) are all included in Expo Go.

### How do I add Rating to my Expo app?

With ExpoKit Pro, add it with the ExpoKit CLI: it copies the component's source into your app and installs react-native-svg, expo-haptics, so the code is yours to change. The install command is on this page for Pro members.

### Is Rating free?

Rating is part of ExpoKit Pro. With a Pro plan, log the CLI in once and it installs the full source into your app.

### Can I change how Rating looks?

Yes. It takes its colours, radius and light / dark mode from useKit(), so wrapping your app in <KitProvider accent radius> re-skins it with every other ExpoKit component. The code lives in your project, so you can also edit anything directly.

## More

- Live preview, variants and code: https://expokit.in/docs/components/rating
- Every ExpoKit component, screen, template and chart: https://expokit.in/llms.txt
- Install commands and props for every free component: https://expokit.in/llms-full.txt
- Pricing: https://expokit.in/pricing
