Skip to main content

Rating

A star (or custom icon) rating input or display.

Playground​

<Rating
value={3}
max={5}
onChange={setValue}
/>

Custom icon​

import { StarIcon } from '@88khp/vajra-icons';

<Rating value={4} icon={StarIcon} onChange={setValue} />

Props​

PropTypeDefaultDescription
valuenumberRequired. Current rating.
onChange(value: number) => voidCalled with the pressed cell's value. Omit (or set isReadOnly) for a display-only rating.
maxnumber5Number of icon cells.
isReadOnlybooleanfalseDisplay-only; taps are ignored.
isDisabledbooleanfalseDims opacity and ignores taps.
sizenumber24Icon size in px.
colorTVajraColors'warning'Filled-cell color.
emptyColorTVajraColors'border'Empty-cell color.
iconTVajraIconComponentFilled-cell icon. Defaults to a plain ★ glyph.
emptyIconTVajraIconComponentEmpty-cell icon. Defaults to a plain ☆ glyph.