1 | import * as React from 'react';
|
2 | import { StandardProps } from '..';
|
3 | import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase';
|
4 |
|
5 | export interface CheckboxProps
|
6 | extends StandardProps<
|
7 | SwitchBaseProps,
|
8 | CheckboxClassKey,
|
9 | 'checkedIcon' | 'color' | 'icon' | 'type'
|
10 | > {
|
11 | /**
|
12 | * If `true`, the component is checked.
|
13 | */
|
14 | checked?: SwitchBaseProps['checked'];
|
15 | /**
|
16 | * The icon to display when the component is checked.
|
17 | */
|
18 | checkedIcon?: React.ReactNode;
|
19 | /**
|
20 | * The color of the component. It supports those theme colors that make sense for this component.
|
21 | */
|
22 | color?: 'primary' | 'secondary' | 'default';
|
23 | /**
|
24 | * If `true`, the checkbox will be disabled.
|
25 | */
|
26 | disabled?: SwitchBaseProps['disabled'];
|
27 | /**
|
28 | * If `true`, the ripple effect will be disabled.
|
29 | */
|
30 | disableRipple?: SwitchBaseProps['disableRipple'];
|
31 | /**
|
32 | * The icon to display when the component is unchecked.
|
33 | */
|
34 | icon?: React.ReactNode;
|
35 | /**
|
36 | * The id of the `input` element.
|
37 | */
|
38 | id?: SwitchBaseProps['id'];
|
39 | /**
|
40 | * If `true`, the component appears indeterminate.
|
41 | * This does not set the native input element to indeterminate due
|
42 | * to inconsistent behavior across browsers.
|
43 | * However, we set a `data-indeterminate` attribute on the input.
|
44 | */
|
45 | indeterminate?: boolean;
|
46 | /**
|
47 | * The icon to display when the component is indeterminate.
|
48 | */
|
49 | indeterminateIcon?: React.ReactNode;
|
50 | /**
|
51 | * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
52 | */
|
53 | inputProps?: SwitchBaseProps['inputProps'];
|
54 | /**
|
55 | * Pass a ref to the `input` element.
|
56 | */
|
57 | inputRef?: React.Ref<HTMLInputElement>;
|
58 | /**
|
59 | * Callback fired when the state is changed.
|
60 | *
|
61 | * @param {object} event The event source of the callback.
|
62 | * You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
63 | */
|
64 | onChange?: SwitchBaseProps['onChange'];
|
65 | /**
|
66 | * If `true`, the `input` element will be required.
|
67 | */
|
68 | required?: SwitchBaseProps['required'];
|
69 | /**
|
70 | * The size of the checkbox.
|
71 | * `small` is equivalent to the dense checkbox styling.
|
72 | */
|
73 | size?: 'small' | 'medium';
|
74 | /**
|
75 | * The value of the component. The DOM API casts this to a string.
|
76 | * The browser uses "on" as the default value.
|
77 | */
|
78 | value?: SwitchBaseProps['value'];
|
79 | }
|
80 |
|
81 | export type CheckboxClassKey =
|
82 | | SwitchBaseClassKey
|
83 | | 'indeterminate'
|
84 | | 'colorPrimary'
|
85 | | 'colorSecondary';
|
86 |
|
87 | /**
|
88 | *
|
89 | * Demos:
|
90 | *
|
91 | * - [Checkboxes](https://mui.com/components/checkboxes/)
|
92 | * - [Transfer List](https://mui.com/components/transfer-list/)
|
93 | *
|
94 | * API:
|
95 | *
|
96 | * - [Checkbox API](https://mui.com/api/checkbox/)
|
97 | * - inherits [IconButton API](https://mui.com/api/icon-button/)
|
98 | */
|
99 | export default function Checkbox(props: CheckboxProps): JSX.Element;
|