Componentform0.91 KB gzipZero dependencies
Rating
Interactive star rating with live hover preview.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add ratingOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { Rating } from "@/components/ui/rating"; <Rating defaultValue={4} max={5} />Source code
rating.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxrating.tsx105 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface RatingProps extends Omit<React.HTMLAttributes<HTMLElement>, "value" | "defaultValue"> { value?: number; defaultValue?: number; max?: number; onValueChange?: (value: number) => void; disabled?: boolean; className?: string; "aria-label"?: string;} export function Rating({ value: controlledValue, defaultValue = 0,Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { Rating } from "@/components/ui/rating"; <Rating />| Prop | Type | Description |
|---|---|---|
| value | number | Controlled value. |
| defaultValue | number | Initial value when uncontrolled. (Default: 0) |
| max | number | Maximum allowed numeric or date bound. (Default: 5) |
| onValueChange | (value: number) => void | Callback invoked on value change. |
| disabled | boolean | Disables interaction and applies disabled styling. (Default: false) |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |
| aria-label | string | Configures aria label. |