UNPKG

2.62 kBTypeScriptView Raw
1import { PropTypes } from '..';
2import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
3import { OverrideProps } from '../OverridableComponent';
4
5export type ButtonTypeMap<
6 P = {},
7 D extends React.ElementType = 'button'
8> = ExtendButtonBaseTypeMap<{
9 props: P & {
10 /**
11 * The content of the button.
12 */
13 children?: React.ReactNode;
14 /**
15 * The color of the component. It supports those theme colors that make sense for this component.
16 */
17 color?: PropTypes.Color;
18 /**
19 * If `true`, the button will be disabled.
20 */
21 disabled?: boolean;
22 /**
23 * If `true`, no elevation is used.
24 */
25 disableElevation?: boolean;
26 /**
27 * If `true`, the keyboard focus ripple will be disabled.
28 */
29 disableFocusRipple?: boolean;
30 /**
31 * Element placed after the children.
32 */
33 endIcon?: React.ReactNode;
34 /**
35 * If `true`, the button will take up the full width of its container.
36 */
37 fullWidth?: boolean;
38 /**
39 * The URL to link to when the button is clicked.
40 * If defined, an `a` element will be used as the root node.
41 */
42 href?: string;
43 /**
44 * The size of the button.
45 * `small` is equivalent to the dense button styling.
46 */
47 size?: 'small' | 'medium' | 'large';
48 /**
49 * Element placed before the children.
50 */
51 startIcon?: React.ReactNode;
52 /**
53 * The variant to use.
54 */
55 variant?: 'text' | 'outlined' | 'contained';
56 };
57 defaultComponent: D;
58 classKey: ButtonClassKey;
59}>;
60
61/**
62 *
63 * Demos:
64 *
65 * - [Button Group](https://mui.com/components/button-group/)
66 * - [Buttons](https://mui.com/components/buttons/)
67 *
68 * API:
69 *
70 * - [Button API](https://mui.com/api/button/)
71 * - inherits [ButtonBase API](https://mui.com/api/button-base/)
72 */
73declare const Button: ExtendButtonBase<ButtonTypeMap>;
74
75export type ButtonProps<
76 D extends React.ElementType = ButtonTypeMap['defaultComponent'],
77 P = {}
78> = OverrideProps<ButtonTypeMap<P, D>, D>;
79
80export type ButtonClassKey =
81 | 'root'
82 | 'label'
83 | 'text'
84 | 'textPrimary'
85 | 'textSecondary'
86 | 'outlined'
87 | 'outlinedPrimary'
88 | 'outlinedSecondary'
89 | 'contained'
90 | 'containedPrimary'
91 | 'containedSecondary'
92 | 'disableElevation'
93 | 'focusVisible'
94 | 'disabled'
95 | 'colorInherit'
96 | 'textSizeSmall'
97 | 'textSizeLarge'
98 | 'outlinedSizeSmall'
99 | 'outlinedSizeLarge'
100 | 'containedSizeSmall'
101 | 'containedSizeLarge'
102 | 'sizeSmall'
103 | 'sizeLarge'
104 | 'fullWidth'
105 | 'startIcon'
106 | 'endIcon'
107 | 'iconSizeSmall'
108 | 'iconSizeMedium'
109 | 'iconSizeLarge';
110
111export default Button;