Skip to Content
⭐️ Leave a star →
ComponentsRating

Rating

Star rating component. Hover preview shows the prospective rating before clicking. Supports read-only (non-interactive) and disabled modes.

Features

Hover preview shows prospective rating before clicking.
Supports read-only and disabled modes.
Can be controlled or uncontrolled.
Custom star styling via starClassName prop.

Example

4.0(128 reviews)
Small
Medium
Large
import { Rating } from '@wire-ui/react' <Rating value={4} readOnly />

Styling

Rating stars expose data-filled (at or below current value) and data-highlighted (hover preview). Style both via starClassName.

<Rating starClassName=" text-gray-300 data-[filled]:text-black data-[highlighted]:text-black data-[disabled]:opacity-50 hover:scale-110 " />

Using data attributes

Each star element sets data-filled and data-highlighted independently. data-disabled is set when the Rating is disabled.

/* Unfilled star */ .star { color: #e5e5e5; } /* Filled or hovered */ .star[data-filled], .star[data-highlighted] { color: #000; }

Props

PropTypeDefaultDescription
valuenumberControlled rating value
defaultValuenumber0Initial value for uncontrolled use
onChange(value: number) => voidCalled when rating changes
maxnumber5Total number of stars
readOnlybooleanfalseNon-interactive; renders role="img"
disabledbooleanfalseDisables interaction

Star data attributes

AttributeWhen present
data-filledThis star is at or below the current rating
data-hoverMouse is hovering this star (hover preview)
Last updated on

MIT License © 2026 wire-ui

Rating – Wire UI