reablocks
Version:
Component library for React
51 lines (50 loc) • 1.25 kB
TypeScript
import { default as React, FC, LegacyRef } from 'react';
import { MotionNodeAnimationOptions } from 'motion/react';
import { ToggleTheme } from './ToggleTheme';
export interface ToggleProps {
/**
* Whether the toggle is checked or not.
*/
checked: boolean;
/**
* Whether the toggle is disabled or not.
*/
disabled?: boolean;
/**
* Whether to animate the toggle.
* @default true
*/
animated?: boolean;
/**
* Animation configuration for the toggle.
*/
animation?: MotionNodeAnimationOptions;
/**
* Additional class names to apply to the toggle.
*/
className?: string;
/**
* The size of the toggle.
* @default 'medium'
*/
size?: 'small' | 'medium' | 'large' | string;
/**
* When the toggle is changed.
*/
onChange?: (value: boolean) => void;
/**
* When the toggle was blurred.
*/
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
/**
* Theme for the Toggle.
*/
theme?: ToggleTheme;
}
export interface ToggleRef {
/**
* Reference to the toggle element.
*/
ref?: LegacyRef<HTMLDivElement>;
}
export declare const Toggle: FC<ToggleProps & ToggleRef>;