@cerberus-design/react
Version:
The Cerberus Design React component library.
35 lines (34 loc) • 1.2 kB
TypeScript
import { UseRatingGroupItemContext } from '@ark-ui/react/rating-group';
import { ReactNode } from 'react';
import { RatingRootProps } from './primitives';
/**
* This module contains the abstracted Rating component.
* @module 'react/rating'
*/
export interface RatingProps extends Omit<RatingRootProps, 'children'> {
/**
* The label of the rating component.
*/
label?: string;
/**
* The children of the rating component.
*/
children: (context: UseRatingGroupItemContext) => ReactNode;
}
/**
* The Rating component is an abstraction of the primitives which provides a
* visual rating system for a user to select a value.
* @description [Cerberus Docs](https://cerberus.digitalu.design/react/rating)
* @description [Ark Docs](https://ark-ui.com/react/docs/components/rating-group#api-reference)
* @example
* ```tsx
* <Rating count={5} defaultValue={3} allowHalf>
* {({ half, highlighted }) => {
* if (half) return <StarHalfIcon fill="current" />
* if (highlighted) return <StarIcon fill="current" />
* return <StarIcon />
* }}
* </Rating>
* ```
*/
export declare function Rating(props: RatingProps): import("react/jsx-runtime").JSX.Element;