Skip to main content

Rating: React

The Rating component provides a visually representation of a numerical assessment.

Installation

Before you can start using the @mediahuis/chameleon-react component, you'll need to install it, for more information check: Getting started for developers.

With that done, you're now ready to implement the component in your application.

import { Rating } from '@mediahuis/chameleon-react';

export default function Example() {
return <Rating value={4} label="Rating" />;
}

Properties

PropertyTypeDefaultRequiredDescription
maxNumber5NoThe maximum value of the rating.
minNumber0NoThe minimum value of the rating.
idString'rating'NoThe step value of the rating.
valueNumber-NoThe current value of the rating.
emptyIconSVGTypeStarNoThe icon to display when the rating is empty.
emptyIconColorChameleonCssToken'var(--rating-foreground-empty-fill)'NoThe color of the empty icon.
fullIconSVGTypeStarFillNoThe icon to display when the rating is full.
fullIconColorChameleonCssToken'var(--rating-foreground-full-fill)'NoThe color of the full icon.
size'sm' | 'lg''sm'NoThe size of the rating.
precisionNumber0.1NoThe precision of the rating.
labelReactNode-NoContents displayed within the PrimaryLabel.
labelHiddenBooleanfalseNoVisually hide the label. (label is still recommended for a11y)