Zephora UI

Form

Rating

Star rating implemented as a radio group of visually hidden inputs, with hover preview, read-only mode and optional clearing.

Import

import { Rating } from "@zephora/react";

Examples

Basic

Controlled with clear

`allowClear` lets clicking the selected star reset the rating to 0.

Your rating: 4

Read-only, custom max, sizes

API

Rating props

PropTypeDefaultDescription
valuenumberControlled rating value (0 = empty).
defaultValuenumber0Initial rating value in uncontrolled mode.
onValueChange(value: number) => voidCalled whenever the rating changes.
maxnumber5Number of stars.
readOnlybooleanfalseDisplays the rating without allowing changes.
disabledbooleanfalseDisables all interaction.
allowClearbooleanfalseClicking the currently selected star clears the rating to 0.
size"sm" | "md" | "lg""md"Star scale.
namestringRadio group name (auto-generated when omitted).
unstyledbooleanfalseHeadless mode — drops Zephora classes so your own CSS can style it.
…restHTMLAttributes<HTMLDivElement>Forwarded to the radiogroup wrapper element.

Keyboard

KeyAction
Arrow keysMove between stars (native radio group navigation).
SpaceSelects the focused star.