UNPKG

1.69 kBTypeScriptView Raw
1import * as React from 'react';
2
3import { StandardProps } from '@material-ui/core';
4
5export interface ToggleButtonGroupProps
6 extends StandardProps<
7 React.HTMLAttributes<HTMLDivElement>,
8 ToggleButtonGroupClassKey,
9 'onChange' | 'children'
10 > {
11 /**
12 * The content of the button.
13 */
14 children?: React.ReactNode;
15 /**
16 * If `true`, only allow one of the child ToggleButton values to be selected.
17 */
18 exclusive?: boolean;
19 /**
20 * Callback fired when the value changes.
21 *
22 * @param {object} event The event source of the callback.
23 * @param {any} value of the selected buttons. When `exclusive` is true
24 * this is a single value; when false an array of selected values. If no value
25 * is selected and `exclusive` is true the value is null; when false an empty array.
26 */
27 onChange?: (event: React.MouseEvent<HTMLElement>, value: any) => void;
28 /**
29 * The group orientation (layout flow direction).
30 */
31 orientation?: 'horizontal' | 'vertical';
32 /**
33 * The size of the buttons.
34 */
35 size?: 'small' | 'medium' | 'large';
36 /**
37 * The currently selected value within the group or an array of selected
38 * values when `exclusive` is false.
39 *
40 * The value must have reference equality with the option in order to be selected.
41 */
42 value?: any;
43}
44
45export type ToggleButtonGroupClassKey =
46 | 'root'
47 | 'vertical'
48 | 'grouped'
49 | 'groupedHorizontal'
50 | 'groupedVertical';
51
52/**
53 *
54 * Demos:
55 *
56 * - [Toggle Button](https://mui.com/components/toggle-button/)
57 *
58 * API:
59 *
60 * - [ToggleButtonGroup API](https://mui.com/api/toggle-button-group/)
61 */
62export default function ToggleButtonGroup(props: ToggleButtonGroupProps): JSX.Element;