react-toggle-slider
Version:
A highly customizable React toggle slider component.
33 lines (32 loc) • 1.61 kB
TypeScript
import React, { CSSProperties } from 'react';
interface ToggleSliderProps {
handleSize?: number;
handleBorderRadius?: number | string;
handleBackgroundColor?: string;
handleBackgroundColorActive?: string;
handleStyles?: CSSProperties;
handleStylesActive?: CSSProperties;
barWidth?: number;
barHeight?: number;
barBorderRadius?: number | string;
barBackgroundColor?: string;
barBackgroundColorActive?: string;
barStyles?: CSSProperties;
barStylesActive?: CSSProperties;
padding?: number;
transitionDuration?: string;
handleTransitionDuration?: string;
barTransitionDuration?: string;
onToggle?: (active: boolean) => void;
handleRenderer?: React.ReactNode;
handleRendererActive?: React.ReactNode;
barRenderer?: React.ReactNode;
barRendererActive?: React.ReactNode;
flip?: boolean;
active?: boolean;
draggable?: boolean;
barTransitionType?: "fade" | "slide";
}
declare function ToggleSlider({ barBackgroundColor, barBackgroundColorActive, barBorderRadius, barHeight, barWidth, handleBackgroundColor, handleBackgroundColorActive, handleBorderRadius, handleSize, padding, transitionDuration, barTransitionDuration, handleTransitionDuration, onToggle, handleRenderer, handleRendererActive, barRenderer, barRendererActive, flip, barStyles, barStylesActive, handleStyles, handleStylesActive, active: initialActive, draggable, barTransitionType, }: ToggleSliderProps): JSX.Element;
declare function useToggleSlider(props?: ToggleSliderProps): (boolean | JSX.Element)[];
export { ToggleSlider, useToggleSlider };