# Interactive half-star rating

> Interactive half-star rating

A shadcn/ui block from the [@reui](https://reui.io) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/reui/c-rating-7).

- Page, with a live preview: https://shadcn.exchange/r/reui/c-rating-7
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/reui/c-rating-7-light-3e506e8644fdf0f1.png
- Registry item: https://reui.io/r/new-york-v4/c-rating-7.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://reui.io/r/new-york-v4/c-rating-7.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@reui/rating`

## Files

### `c-rating-7.tsx`

```tsx
"use client"

import { useState } from "react"
import { Rating } from "@/components/reui/rating"

export function Pattern() {
  const [rating, setRating] = useState(3.5)

  return (
    <div className="mx-auto flex w-full max-w-xs flex-col items-center gap-4">
      <Rating rating={rating} onRatingChange={setRating} editable />
      <p className="text-muted-foreground text-sm">
        Your rating:{" "}
        <span className="text-foreground font-semibold">
          {rating.toFixed(1)}
        </span>{" "}
        / 5
      </p>
    </div>
  )
}
```
