react-customizable-star-rating
Version:
React component to view and set rating
24 lines (23 loc) • 858 B
TypeScript
import React, { MouseEventHandler } from 'react';
type StarProps = {
index: number;
full: boolean;
half: boolean;
onHoverIn?: React.Dispatch<React.SetStateAction<number>>;
onHoverOut?: MouseEventHandler<HTMLSpanElement>;
size: number;
color: string;
borderColor: string;
viewOnly?: boolean;
onRate?: React.Dispatch<React.SetStateAction<number>>;
onSetRating?: React.Dispatch<React.SetStateAction<number>>;
dir?: 'ltr' | 'rtl';
} & ({
viewOnly: true;
} | {
viewOnly?: false;
onSetRating: React.Dispatch<React.SetStateAction<number>>;
onRate: React.Dispatch<React.SetStateAction<number>>;
});
export declare const Star: ({ index, onRate, full, half, onHoverIn, onHoverOut, size, color, borderColor, onSetRating, viewOnly, dir }: StarProps) => React.JSX.Element;
export {};