Ashish Sharma

Star Rating

Forms

About

A star rating input built on native radio buttons, with keyboard arrow support, half-star steps, a hover preview, and a read-only mode for showing an average rating with a count.

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

Code

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

Usage.tsx

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

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

  return (
    <div className="flex min-h-[320px] w-full flex-col items-center justify-center gap-10 bg-background p-10">
      <Rating label="Rate this recipe" value={value} onValueChange={setValue} />
      <Rating label="Rate with half stars" step={0.5} defaultValue={3.5} />
      <Rating label="Average rating" readOnly value={4.3} count={1286} />
    </div>
  );
}

More by Ashish Sharma

View all
  • Perspective Gallery

    Perspective Gallery

    149
  • Bento Features

    Bento Features

    27
  • Animated Sidebar

    Animated Sidebar

    25
  • Otp Input

    Otp Input

    25
  • Glow Ring

    Glow Ring

    20
  • Notification Stack

    Notification Stack

    11
  • Expandable Tabs

    Expandable Tabs

    11
  • Voice Orb

    Voice Orb

    8

More in Forms

View all
  • Form

    Form

    7
  • Login 2

    Login 2

    16
  • Contact Form

    Contact Form

    32
  • Book A Demo 1

    Book A Demo 1

    95
  • Contact Card

    Contact Card

    1.1K
  • Premium Auth

    Premium Auth

    613
  • Authentication Card

    Authentication Card

    52
  • Form

    Form

    18