UNPKG

@geneui/components

Version:

The Gene UI components library designed for BI tools

50 lines (49 loc) 1.75 kB
import { FC, ReactNode } from 'react'; import './Rating.scss'; export interface IRatingProps { defaultValue?: number; /** * The currently selected rating value. Use this to control the component from the outside.<br> * If this prop is used the component will lose default behavior related to rating state. */ value?: number; /** * The number of rating elements to render. */ count?: number; /** * The icon or character used to represent each rating element.<br> * It can be a `React functional component`, `string`, `number`, or a `function` that returns a React node.<br> * Possible values: `FC | string | number | ((i: number) => ReactNode)` */ character?: FC | string | number | ((i: number) => ReactNode); /** * The color is used for the rating elements when hovered over or selected. */ color?: string; /** * The background color of the rating elements. */ bgColor?: string; /** * Allows users to select half values in the rating component, enabling finer granularity.<br> * For example, if `count` is 5, users can select 1, 1.5, 2, 2.5, and so on up to 5. */ halfAllow?: boolean; /** * When set to `true`, the rating component becomes read-only, preventing any interaction. */ readonly?: boolean; /** * The size of the rating elements.<br> * Possible values: `small | medium | big` */ size?: 'small' | 'medium' | 'big'; /** * Callback function that is called when the rating value changes.<br> * Receives the new rating value as an argument. */ onChange?: (rating: number) => void; } declare const Rating: FC<IRatingProps>; export default Rating;