UNPKG

1.13 kBTypeScriptView Raw
1import * as React from 'react';
2export type SwitchSize = 'small' | 'default';
3export type SwitchChangeEventHandler = (checked: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
4export type SwitchClickEventHandler = SwitchChangeEventHandler;
5export interface SwitchProps {
6 prefixCls?: string;
7 size?: SwitchSize;
8 className?: string;
9 rootClassName?: string;
10 checked?: boolean;
11 defaultChecked?: boolean;
12 /**
13 * Alias for `checked`.
14 * @since 5.12.0
15 */
16 value?: boolean;
17 /**
18 * Alias for `defaultChecked`.
19 * @since 5.12.0
20 */
21 defaultValue?: boolean;
22 onChange?: SwitchChangeEventHandler;
23 onClick?: SwitchClickEventHandler;
24 checkedChildren?: React.ReactNode;
25 unCheckedChildren?: React.ReactNode;
26 disabled?: boolean;
27 loading?: boolean;
28 autoFocus?: boolean;
29 style?: React.CSSProperties;
30 title?: string;
31 tabIndex?: number;
32 id?: string;
33}
34type CompoundedComponent = React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLElement>> & {};
35declare const Switch: CompoundedComponent;
36export default Switch;