kevingirelli

Rating

Forms

About

A star rating component for giving or showing a score, usable as an interactive radio group or a read-only display with fractional star fills.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Rating to your project and fits it to your theme.

Code

How Rating is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import * as React from "react";
import { Rating } from "@/components/ui/rating";

export default function RatingDemo() {
  const [score, setScore] = React.useState(3);

  return (
    <div className="flex flex-col items-center gap-6">
      <div className="flex flex-col items-center gap-2">
        <span className="text-sm text-muted-foreground">Interactive</span>
        <Rating
          defaultValue={score}
          onValueChange={setScore}
          aria-label="Your rating"
        />
      </div>
      <div className="flex flex-col items-center gap-2">
        <span className="text-sm text-muted-foreground">Read-only</span>
        <Rating readOnly value={4.5} />
      </div>
    </div>
  );
}

Dependencies

More by kevingirelli

View all
  • Aurora

    Aurora

    81
  • QR Code

    QR Code

    70
  • Warp Gradient

    Warp Gradient

    55
  • FAQ Section

    FAQ Section

    53
  • Corner Frame

    Corner Frame

    43
  • Animated Border

    Animated Border

    43
  • Wave Text

    Wave Text

    41
  • Spotlight

    Spotlight

    33

More in Forms

View all
  • Contact Card

    Contact Card

    1K
  • Premium Auth

    Premium Auth

    525
  • Login 2

    Login 2

    8
  • Form

    Form

    16
  • Card Studio

    Card Studio

    41
  • HeroUI Field Error

    HeroUI Field Error

    10
  • Book A Demo 1

    Book A Demo 1

    74
  • Book A Demo 3

    Book A Demo 3

    90