Mahmoud Ilyan

Rating

Component

About

An interactive star rating control for collecting or displaying a score out of a configurable number of stars, supporting hover preview, click-to-rate, and a read-only display mode.

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

"use client";

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

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

  return (
    <div className="flex flex-col items-center gap-6">
      <Rating value={value} onValueChange={setValue} label="Your rating" />
      <Rating value={4} readOnly label="Average rating" />
    </div>
  );
}

Dependencies

More by Mahmoud Ilyan

View all
  • Steps

    Steps

    5
  • Chart

    Chart

    2
  • Radio Card

    Radio Card

    1
  • Switch

    Switch

    1
  • Input

    Input

    1
  • Badge

    Badge

    1
  • Textarea

    Textarea

  • Tabs

    Tabs