UNPKG

1.47 kBTypeScriptView Raw
1import * as React from 'react';
2import { StandardProps } from '..';
3import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase';
4
5export interface SwitchProps
6 extends StandardProps<SwitchBaseProps, SwitchClassKey, 'checkedIcon' | 'color' | 'icon'> {
7 /**
8 * The icon to display when the component is checked.
9 */
10 checkedIcon?: React.ReactNode;
11 /**
12 * The color of the component. It supports those theme colors that make sense for this component.
13 */
14 color?: 'primary' | 'secondary' | 'default';
15 /**
16 * If `true`, the switch will be disabled.
17 */
18 disabled?: boolean;
19 /**
20 * The icon to display when the component is unchecked.
21 */
22 icon?: React.ReactNode;
23 /**
24 * The size of the switch.
25 * `small` is equivalent to the dense switch styling.
26 */
27 size?: 'small' | 'medium';
28 /**
29 * The value of the component. The DOM API casts this to a string.
30 * The browser uses "on" as the default value.
31 */
32 value?: unknown;
33}
34
35export type SwitchClassKey =
36 | SwitchBaseClassKey
37 | 'switchBase'
38 | 'colorPrimary'
39 | 'colorSecondary'
40 | 'sizeSmall'
41 | 'thumb'
42 | 'track';
43
44/**
45 *
46 * Demos:
47 *
48 * - [Switches](https://mui.com/components/switches/)
49 * - [Transfer List](https://mui.com/components/transfer-list/)
50 *
51 * API:
52 *
53 * - [Switch API](https://mui.com/api/switch/)
54 * - inherits [IconButton API](https://mui.com/api/icon-button/)
55 */
56export default function Switch(props: SwitchProps): JSX.Element;