UNPKG

1.53 kBTypeScriptView Raw
1import * as React from 'react';
2import { OUIAProps } from '../../helpers';
3export interface SwitchProps extends Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'onChange' | 'disabled' | 'label'>, OUIAProps {
4 /** id for the label. */
5 id?: string;
6 /** Additional classes added to the switch */
7 className?: string;
8 /** Text value for the label when on */
9 label?: React.ReactNode;
10 /** Text value for the label when off */
11 labelOff?: React.ReactNode;
12 /** Flag to show if the switch is checked. */
13 isChecked?: boolean;
14 /** Flag to show if the switch has a check icon. */
15 hasCheckIcon?: boolean;
16 /** Flag to show if the switch is disabled. */
17 isDisabled?: boolean;
18 /** A callback for when the switch selection changes. (isChecked, event) => {} */
19 onChange?: (checked: boolean, event: React.FormEvent<HTMLInputElement>) => void;
20 /** Adds accessible text to the switch, and should describe the isChecked="true" state. When label is defined, aria-label should be set to the text string that is visible when isChecked is true. */
21 'aria-label'?: string;
22 /** Flag to reverse the layout of toggle and label (toggle on right). */
23 isReversed?: boolean;
24}
25export declare class Switch extends React.Component<SwitchProps & OUIAProps, {
26 ouiaStateId: string;
27}> {
28 static displayName: string;
29 id: string;
30 static defaultProps: SwitchProps;
31 constructor(props: SwitchProps & OUIAProps);
32 render(): JSX.Element;
33}
34//# sourceMappingURL=Switch.d.ts.map
\No newline at end of file