1 | import { SxProps } from '@mui/system';
|
2 | import { OverridableStringUnion } from '@mui/types';
|
3 | import * as React from 'react';
|
4 | import { Theme } from '..';
|
5 | import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
|
6 | import { OverrideProps } from '../OverridableComponent';
|
7 | import { ToggleButtonClasses } from './toggleButtonClasses';
|
8 |
|
9 | export interface ToggleButtonPropsSizeOverrides {}
|
10 |
|
11 | export interface ToggleButtonPropsColorOverrides {}
|
12 |
|
13 | export interface ToggleButtonOwnProps {
|
14 | /**
|
15 | * The content of the component.
|
16 | */
|
17 | children?: React.ReactNode;
|
18 | /**
|
19 | * Override or extend the styles applied to the component.
|
20 | */
|
21 | classes?: Partial<ToggleButtonClasses>;
|
22 | /**
|
23 | * The color of the button when it is in an active state.
|
24 | * It supports both default and custom theme colors, which can be added as shown in the
|
25 | * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
26 | * @default 'standard'
|
27 | */
|
28 | color?: OverridableStringUnion<
|
29 | 'standard' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning',
|
30 | ToggleButtonPropsColorOverrides
|
31 | >;
|
32 | /**
|
33 | * If `true`, the component is disabled.
|
34 | * @default false
|
35 | */
|
36 | disabled?: boolean;
|
37 | /**
|
38 | * If `true`, the keyboard focus ripple is disabled.
|
39 | * @default false
|
40 | */
|
41 | disableFocusRipple?: boolean;
|
42 | /**
|
43 | * If `true`, the button will take up the full width of its container.
|
44 | * @default false
|
45 | */
|
46 | fullWidth?: boolean;
|
47 | /**
|
48 | * Callback fired when the state changes.
|
49 | *
|
50 | * @param {React.MouseEvent<HTMLElement>} event The event source of the callback.
|
51 | * @param {any} value of the selected button.
|
52 | */
|
53 | onChange?: (event: React.MouseEvent<HTMLElement>, value: any) => void;
|
54 | /**
|
55 | * Callback fired when the button is clicked.
|
56 | *
|
57 | * @param {React.MouseEvent<HTMLElement>} event The event source of the callback.
|
58 | * @param {any} value of the selected button.
|
59 | */
|
60 | onClick?: (event: React.MouseEvent<HTMLElement>, value: any) => void;
|
61 | /**
|
62 | * If `true`, the button is rendered in an active state.
|
63 | */
|
64 | selected?: boolean;
|
65 | /**
|
66 | * The size of the component.
|
67 | * The prop defaults to the value inherited from the parent ToggleButtonGroup component.
|
68 | * @default 'medium'
|
69 | */
|
70 | size?: OverridableStringUnion<'small' | 'medium' | 'large', ToggleButtonPropsSizeOverrides>;
|
71 | /**
|
72 | * The system prop that allows defining system overrides as well as additional CSS styles.
|
73 | */
|
74 | sx?: SxProps<Theme>;
|
75 | /**
|
76 | * The value to associate with the button when selected in a
|
77 | * ToggleButtonGroup.
|
78 | */
|
79 | value: NonNullable<unknown>;
|
80 | }
|
81 |
|
82 | export type ToggleButtonTypeMap<
|
83 | AdditionalProps = {},
|
84 | RootComponent extends React.ElementType = 'button',
|
85 | > = ExtendButtonBaseTypeMap<{
|
86 | props: AdditionalProps & ToggleButtonOwnProps;
|
87 | defaultComponent: RootComponent;
|
88 | }>;
|
89 |
|
90 | /**
|
91 | *
|
92 | * Demos:
|
93 | *
|
94 | * - [Toggle Button](https://mui.com/material-ui/react-toggle-button/)
|
95 | *
|
96 | * API:
|
97 | *
|
98 | * - [ToggleButton API](https://mui.com/material-ui/api/toggle-button/)
|
99 | * - inherits [ButtonBase API](https://mui.com/material-ui/api/button-base/)
|
100 | */
|
101 | declare const ToggleButton: ExtendButtonBase<ToggleButtonTypeMap>;
|
102 |
|
103 | export type ToggleButtonProps<
|
104 | RootComponent extends React.ElementType = ToggleButtonTypeMap['defaultComponent'],
|
105 | AdditionalProps = {},
|
106 | > = OverrideProps<ToggleButtonTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
107 | component?: React.ElementType;
|
108 | };
|
109 |
|
110 | export default ToggleButton;
|