Rating

Ratings are used to provide feedback on a scale.

import { Rating, RatingParts } from '@cerberus/react'

Usage

The Rating component is an abstracted client component that provides a way to select a value from a range of values. It is used to provide feedback on a scale. The default count is 5, and the default value is 0.

Readonly State

To render the Rating component in a read-only state, you can use the readOnly prop.

Orientation

The Rating component supports two layout orientations for label usage: horizontal, and vertical. The default orientation is vertical.

Sizes

The Rating component supports two sizes: sm, and md. The default size is sm.

Primitives

You can utilize the primitive components to customize the radio.

ComponentDescription
RatingRootThe context provider for the Rating parts
RatingLabelThe label of the rating
RatingControlThe visual control of the rating
RatingContextThe context provider for the rating
RatingItemThe container of the rating item
RatingItemContextThe context provider for a rating item
RatingHiddenInputThe native input for the rating

API

Props

Rating

The Rating component is an abstraction of the primitives and accepts the following props:

NameDefaultDescription
orientationhorizontalThis orientation of the group.
paletteactionThe color palette of the items .
sizesmThe size of the label.

The Rating component also accepts all the props of the RatingRoot primitive props

Parts

The RatingParts API is an Object containing the full family of components.

NameDescription
RootThe RatingRoot component which is the Provider for the family.
LabelThe RatingLabel component which displays the label.
ControlThe RatingControl component which displays the visual rating.
ItemThe RatingItem component which is the container to a single item.
ItemContextThe RatingItemContext component which is the context provider for a single item.
HiddenInputThe RatingHiddenInput component which displays the native radio.