UNPKG

2.18 kBTypeScriptView Raw
1import * as React from 'react';
2import { PickOptional } from '../../helpers/typeUtils';
3export interface ToggleProps {
4 /** HTML ID of dropdown toggle */
5 id: string;
6 /** Type to put on the button */
7 type?: 'button' | 'submit' | 'reset';
8 /** Anything which can be rendered as dropdown toggle */
9 children?: React.ReactNode;
10 /** Classes applied to root element of dropdown toggle */
11 className?: string;
12 /** Flag to indicate if menu is opened */
13 isOpen?: boolean;
14 /** Callback called when toggle is clicked */
15 onToggle?: (isOpen: boolean, event: MouseEvent | TouchEvent | KeyboardEvent | React.KeyboardEvent<any> | React.MouseEvent<HTMLButtonElement>) => void;
16 /** Callback called when the Enter key is pressed */
17 onEnter?: () => void;
18 /** Element which wraps toggle */
19 parentRef?: any;
20 /** The menu element */
21 getMenuRef?: () => HTMLElement;
22 /** Forces active state */
23 isActive?: boolean;
24 /** Disables the dropdown toggle */
25 isDisabled?: boolean;
26 /** Display the toggle with no border or background */
27 isPlain?: boolean;
28 /** Display the toggle in text only mode */
29 isText?: boolean;
30 /** @deprecated Use `toggleVariant` instead. Display the toggle with a primary button style */
31 isPrimary?: boolean;
32 /** Style the toggle as a child of a split button */
33 isSplitButton?: boolean;
34 /** Alternate styles for the dropdown toggle button */
35 toggleVariant?: 'primary' | 'secondary' | 'default';
36 /** Flag for aria popup */
37 'aria-haspopup'?: boolean | 'listbox' | 'menu' | 'dialog' | 'grid' | 'tree';
38 /** Allows selecting toggle to select parent */
39 bubbleEvent?: boolean;
40}
41export declare class Toggle extends React.Component<ToggleProps> {
42 static displayName: string;
43 private buttonRef;
44 static defaultProps: PickOptional<ToggleProps>;
45 componentDidMount: () => void;
46 componentWillUnmount: () => void;
47 onDocClick: (event: MouseEvent | TouchEvent) => void;
48 onEscPress: (event: KeyboardEvent) => void;
49 onKeyDown: (event: React.KeyboardEvent<any>) => void;
50 render(): JSX.Element;
51}
52//# sourceMappingURL=Toggle.d.ts.map
\No newline at end of file