---
title: Rating Bar
description: An interactive star or number rating input.
---
## Preview
## Installation
CLI
Manual
```bash
npx @olyx/cli@latest add rating-bar
```
Install the following dependencies:
```bash
npm install @base-ui/react
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage
```tsx
import { RatingBar, RatingBarItem } from "@/components/ui/rating-bar"
```
```tsx
{[1, 2, 3, 4, 5].map((n) => (
{n}
))}
```
## API Reference
### RatingBar
Root component. Wraps `RadioGroup` with rating-specific styling.
| Prop | Type | Default |
| --------- | ----------------------- | ------- |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` |
| `styling` | `"star" \| "heart"` | — |
### RatingBarItem
Individual rating option. Wraps `RadioGroupItem` from the radio component.
## Examples
### Custom data
### Heart Styling
### Small Size
### Large Size