Skip to Content

Rating

A feedback component that allows users to provide ratings from a visual scale.Β 

Disabled

Use the disabled attr or the disabled class to disable a component.

Read Only

Use the readOnly attr to make the component read-only.

Compound Version

If you need more control over the children, you can use the compound version of the component.

Custom Symbols

Use the single props to keep only one child highlighted.

With Fractions

Use the fractions prop when you need fractional ratings.

Controlled

Use the value and onValueChange props when you need to control the value externally.

Uncontrolled

Use the name prop to include the value in the form submission.


Sizes

Use the rating-{size} class to control the component size.

Size values can include:smmdlg.

For more information on all available sizing utilities, visit TailwindΒ 

Palette

Use the text-{color} class to control the component color. Refer to the Colors documentation to see all available color and shade options.

For more information on all available color utilities, visit TailwindΒ .

Customizing

globals.css
:root { --ex-rating-cursor: default; --ex-rating-gap-x-sm: calc(var(--spacing) * 0.5); --ex-rating-gap-x-md: calc(var(--spacing) * 0.5); --ex-rating-gap-x-lg: calc(var(--spacing) * 0.5); --ex-rating-indicator-font-size-sm: var(--text-base); --ex-rating-indicator-font-size-md: var(--text-lg); --ex-rating-indicator-font-size-lg: var(--text-xl); }

API

Rating

ElementSelector
Rating.ex-rating
PropTypeDefault
asElementTypediv
asChildbooleanfalse
countnumber
defaultValuestring
disabledbooleanfalse
fractionsnumber
loopbooleantrue
namestring
readOnlybooleanfalse
requiredbooleanfalse
singlebooleanfalse
valuestring
onValueChangefunction

Rating Control

ElementSelector
Rating.Control.ex-rating-control
PropTypeDefault
asElementTypebutton
asChildbooleanfalse
disabledbooleanfalse
requiredbooleanfalse
valuestring

Rating Indicator

ElementSelector
Rating.Indicator.ex-rating-indicator
PropTypeDefault
asElementTypediv
asChildbooleanfalse
forceMountbooleantrue
Last updated on