Skip to content

Constellation Rating

Faceted stars lift into selection with a small marker beneath the chosen rating.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import ConstellationRating from "./ConstellationRating";
export default function Example() {
return (
<ConstellationRating
defaultValue={3}
count={5}
color={"#d8b77e"}
label={"How did it feel?"}
disabled={false}
/>
);
}

Using Constellation Rating

Use value and onValueChange to store a rating, or defaultValue for local state. The component uses native radio inputs, including arrow-key navigation and form submission.

Use formatLabel to localise each option or describe what its rating means. Hover previews a rating without committing it; touch and keyboard selection update the value directly.

Props

NameTypeRequiredDefaultDescription
valuenumberNoundefinedControlled rating.
defaultValuenumberNo0Initial rating, with zero meaning no selection.
onValueChangefunctionNoundefinedReceives the selected rating from one through count.
countnumberNo5Maximum rating, from 1 to 10.
colorstringNo"#d8b77e"Selected star colour.
labelstringNo"Rating"Visible group label.
formatLabelfunctionNoundefinedReceives a rating and maximum to create a localised radio label.
disabledbooleanNofalseDisable all rating options.
namestringNoundefinedOptional radio group name for form submission.
classNamestringNo""Additional classes on the root element.
styleCSSPropertiesNoundefinedInline styles for sizing, typography and appearance.

Related components

A recessed password field pairs a reveal control with an optional strength indicator.

Editable tags collect inside a softly framed input with individual remove controls.

A recessed search field expands into a polished capsule as you type.

A bank of tactile keys holds independent selections with illuminated indicators.