Skip to Content
ComponentsRating

Rating

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

Preview

Usage

import { Rating } from '@wire-ui/react' // Interactive <Rating defaultValue={3} max={5} onChange={(v) => console.log(v)} /> // Controlled <Rating value={rating} onChange={setRating} /> // Read-only (renders as role="img") <Rating value={4} readOnly /> // Disabled <Rating value={2} disabled />

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