NewReUI Pro is now available! Get 20% off with early bird pricing.View pricing
Overview
  • Introduction
  • Get Started
  • License Setup
  • Styling
  • MCP
  • Registry
  • Roadmap
  • Changelog
  • llms.txt
  • v1 Docs
Components
  • Alert
  • Autocomplete
  • Badge
  • Data GridVirtualization and row pinning support added
  • Date Selector
  • File Upload
  • Filters
  • Frame
  • Shadcn Icon Stack
  • Kanban
  • Number Field
  • Phone Input
  • Rating
  • Scrollspy
  • Sortable
  • Stepper
  • Timeline
  • Tree

Application

  • Authentication
  • Card
  • Chart
  • Data Grid
  • Dialog
  • Browse all

eCommerce

  • Shopping Cart
  • Category Card
  • Checkout
  • Comparison
  • Coupon
  • Browse all

Marketing

  • Blog
  • Comparison Table
  • Contact
  • Content Section
  • CTA
  • Browse all

SaaS

  • Analytics
  • Billing
  • Dashboard
  • Integrations
  • Notifications
  • Browse all

Fintech

  • Accounts
  • Transactions
  • Transfer
  • Cards
  • Investments
  • Browse all

Dev Tools

  • API Console
  • CI/CD
  • Code Editor
  • Debug Panel
  • Documentation
  • Browse all

AI & LLM

  • AI Playground
  • AI Settings
  • Chat Interface
  • Embeddings
  • Evaluation
  • Browse all

Data Visualization

  • Charts
  • Dashboards
  • Heatmaps
  • Maps
  • Metrics
  • Browse all

Resources

  • Components
  • Blocks
  • Docs
  • Help & Contact
  • Pricing
  • RoadmapSoon
  • AffiliateSoon

Legal

  • Privacy Policy
  • Terms & Conditions
  • Licensing
  • Cookies

© 2026 ReUI. All rights reserved.

ComponentsBlocksIconsTemplatesDocsPricing
X
LoginGet All-access
2.5k

Shadcn Rating

PreviousNext

Custom Shadcn Rating for React and Tailwind CSS. A customizable star rating component that supports read-only display and interactive input modes.

Base UIRadix UI
Radix UI

Installation

pnpm dlx shadcn@latest add @reui/rating

More Shadcn Rating Components

Browse 9 production-ready Shadcn Rating components for dashboards, forms, and product UI. These examples follow the Radix UI implementation with accessible primitives from the Radix stack and stay fully compatible with Shadcn Create so radius, color, and typography match your configured theme.

Browse all 9 Shadcn Rating components for copy-ready layouts, dashboards, and forms built with Tailwind CSS in the ReUI library.

Phone InputScrollspy

On This Page

InstallationUsageExamplesDecimalShow ValueEditableSizeAPI ReferenceRating

Usage

import { Rating } from "@/components/reui/rating"
<Rating rating={4.5} showValue editable />

Examples

Decimal

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

export function Pattern() {
  return <Rating rating={3.5} />
}

Show Value

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

export function Pattern() {
  return <Rating rating={4.5} showValue={true} />
}

Editable

"use client"

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

export function Pattern() {
  const [productRating, setProductRating] = useState(0)

  const handleRatingChange = (rating: number) => {
    setProductRating(rating)

    toast.success("Rated {rating} out of 5", {
      description: `Rated ${rating} out of 5`,
    })
  }

  return (
    <div className="space-y-8">
      <Rating
        rating={productRating}
        editable={true}
        onRatingChange={handleRatingChange}
        showValue={true}
      />
    </div>
  )
}

Size

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

export function Pattern() {
  return (
    <div className="flex flex-col items-center gap-4">
      <Rating rating={4} size="sm" />
      <Rating rating={4} />
      <Rating rating={4} size="lg" />
    </div>
  )
}

API Reference

Rating

The main component for displaying and editing star ratings.

PropTypeDefaultDescription
ratingnumber-Required. The current rating value. Supports decimal values for partial stars.
maxRatingnumber5Total number of stars to display.
size"sm" | "default" | "lg""md"The size of the stars and spacing.
showValuebooleanfalseWhether to show the numeric rating value next to the stars.
editablebooleanfalseWhether the rating can be changed by clicking on stars.
onRatingChange(rating: number) => void-Callback fired when a star is clicked (if editable is true).
starClassNamestring-Additional CSS classes for the numeric value container.
classNamestring-Additional CSS classes for the root container.
import { Rating } from "@/components/reui/rating"

export function Pattern() {
  return <Rating rating={4} />
}