1 | import * as React from 'react';
|
2 | import { SxProps } from '@mui/system';
|
3 | import { OverridableStringUnion } from '@mui/types';
|
4 | import { InternalStandardProps as StandardProps, Theme } from '..';
|
5 | import { SwitchBaseProps } from '../internal/SwitchBase';
|
6 | import { CheckboxClasses } from './checkboxClasses';
|
7 |
|
8 | export interface CheckboxPropsSizeOverrides {}
|
9 |
|
10 | export interface CheckboxPropsColorOverrides {}
|
11 |
|
12 | export interface CheckboxProps
|
13 | extends StandardProps<SwitchBaseProps, 'checkedIcon' | 'color' | 'icon' | 'type'> {
|
14 | /**
|
15 | * If `true`, the component is checked.
|
16 | */
|
17 | checked?: SwitchBaseProps['checked'];
|
18 | /**
|
19 | * The icon to display when the component is checked.
|
20 | * @default <CheckBoxIcon />
|
21 | */
|
22 | checkedIcon?: React.ReactNode;
|
23 | /**
|
24 | * Override or extend the styles applied to the component.
|
25 | */
|
26 | classes?: Partial<CheckboxClasses>;
|
27 | /**
|
28 | * The color of the component.
|
29 | * It supports both default and custom theme colors, which can be added as shown in the
|
30 | * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
31 | * @default 'primary'
|
32 | */
|
33 | color?: OverridableStringUnion<
|
34 | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'default',
|
35 | CheckboxPropsColorOverrides
|
36 | >;
|
37 | /**
|
38 | * If `true`, the component is disabled.
|
39 | * @default false
|
40 | */
|
41 | disabled?: SwitchBaseProps['disabled'];
|
42 | /**
|
43 | * If `true`, the ripple effect is disabled.
|
44 | * @default false
|
45 | */
|
46 | disableRipple?: SwitchBaseProps['disableRipple'];
|
47 | /**
|
48 | * The icon to display when the component is unchecked.
|
49 | * @default <CheckBoxOutlineBlankIcon />
|
50 | */
|
51 | icon?: React.ReactNode;
|
52 | /**
|
53 | * The id of the `input` element.
|
54 | */
|
55 | id?: SwitchBaseProps['id'];
|
56 | /**
|
57 | * If `true`, the component appears indeterminate.
|
58 | * This does not set the native input element to indeterminate due
|
59 | * to inconsistent behavior across browsers.
|
60 | * However, we set a `data-indeterminate` attribute on the `input`.
|
61 | * @default false
|
62 | */
|
63 | indeterminate?: boolean;
|
64 | /**
|
65 | * The icon to display when the component is indeterminate.
|
66 | * @default <IndeterminateCheckBoxIcon />
|
67 | */
|
68 | indeterminateIcon?: React.ReactNode;
|
69 | /**
|
70 | * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
71 | */
|
72 | inputProps?: SwitchBaseProps['inputProps'];
|
73 | /**
|
74 | * Pass a ref to the `input` element.
|
75 | */
|
76 | inputRef?: React.Ref<HTMLInputElement>;
|
77 | /**
|
78 | * Callback fired when the state is changed.
|
79 | *
|
80 | * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
81 | * You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
82 | */
|
83 | onChange?: SwitchBaseProps['onChange'];
|
84 | /**
|
85 | * If `true`, the `input` element is required.
|
86 | * @default false
|
87 | */
|
88 | required?: SwitchBaseProps['required'];
|
89 | /**
|
90 | * The size of the component.
|
91 | * `small` is equivalent to the dense checkbox styling.
|
92 | * @default 'medium'
|
93 | */
|
94 | size?: OverridableStringUnion<'small' | 'medium' | 'large', CheckboxPropsSizeOverrides>;
|
95 | /**
|
96 | * The system prop that allows defining system overrides as well as additional CSS styles.
|
97 | */
|
98 | sx?: SxProps<Theme>;
|
99 | /**
|
100 | * The value of the component. The DOM API casts this to a string.
|
101 | * The browser uses "on" as the default value.
|
102 | */
|
103 | value?: SwitchBaseProps['value'];
|
104 | }
|
105 |
|
106 | /**
|
107 | *
|
108 | * Demos:
|
109 | *
|
110 | * - [Checkbox](https://mui.com/material-ui/react-checkbox/)
|
111 | * - [Transfer List](https://mui.com/material-ui/react-transfer-list/)
|
112 | *
|
113 | * API:
|
114 | *
|
115 | * - [Checkbox API](https://mui.com/material-ui/api/checkbox/)
|
116 | * - inherits [ButtonBase API](https://mui.com/material-ui/api/button-base/)
|
117 | */
|
118 | export default function Checkbox(props: CheckboxProps): React.JSX.Element;
|