ts-spin-wheel
Version:
A customizable spin wheel component for React with TypeScript, sound, easing, and modal support.
32 lines (31 loc) • 1.07 kB
TypeScript
import React from 'react';
import './SpinWheel.css';
export type Sector = {
color: string;
text: string;
label: string;
};
export type SpinWheelProps = {
sectors: Sector[];
size?: number;
onSpinEnd?: (sector: Sector) => void;
spinButtonText?: string | ((isSpinning: boolean, currentLabel: string) => string);
labelFontSize?: number;
spinButtonFontSize?: number;
spinButtonStyles?: React.CSSProperties;
spinButtonArrowStyle?: React.CSSProperties;
spinButtonClassName?: string;
spinButtonArrowColor?: string;
wheelBaseWidth?: string | number;
wheelBaseBottom?: string | number;
customModalContent?: (winner: Sector, onClose: () => void) => React.ReactNode;
enableSound?: boolean;
customSound?: string;
spinDuration?: number;
easingFunction?: (t: number) => number;
};
export type SpinWheelHandle = {
spin: () => void;
};
declare const SpinWheel: React.ForwardRefExoticComponent<SpinWheelProps & React.RefAttributes<SpinWheelHandle>>;
export default SpinWheel;