react-custom-rating-component
Version:
A fully customizable rating component for react and next.js
36 lines • 1.27 kB
TypeScript
import React from 'react';
export interface SvgIconStyleProps {
width: string;
height: string;
}
export interface IconStylesProps {
iconStyles: SvgIconStyleProps;
activeColor?: string;
defaultColor?: string;
}
export type RatingProps = {
precision?: 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1;
count?: number;
shape?: 'star' | 'heart' | 'custom';
activeColor?: string;
defaultColor?: string;
defaultValue: number;
readOnly?: boolean;
size?: string;
spacing?: string;
titleArray?: string[];
showTitle?: boolean;
onChange?: (newRating: number) => void;
onHover?: (hoveredRating: number) => void;
} & ({
shape?: 'star' | 'heart';
emptyIcon?: (IconStyles: IconStylesProps) => JSX.Element;
fillIcon?: (IconStyles: IconStylesProps) => JSX.Element;
} | {
shape: 'custom';
emptyIcon: (IconStyles: IconStylesProps) => JSX.Element;
fillIcon: (IconStyles: IconStylesProps) => JSX.Element;
});
declare const Rating: ({ precision, count, shape, defaultValue, onChange, onHover, readOnly, size, spacing, activeColor, defaultColor, titleArray, showTitle, emptyIcon, fillIcon, }: RatingProps) => React.JSX.Element;
export default Rating;
//# sourceMappingURL=index.d.ts.map