UNPKG

2.9 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { OverridableStringUnion } from '@mui/types';
4import { Theme } from '..';
5import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
6import { OverrideProps } from '../OverridableComponent';
7import { IconButtonClasses } from './iconButtonClasses';
8
9export interface IconButtonPropsColorOverrides {}
10
11export interface IconButtonPropsSizeOverrides {}
12
13export interface IconButtonOwnProps {
14 /**
15 * The icon to display.
16 */
17 children?: React.ReactNode;
18 /**
19 * Override or extend the styles applied to the component.
20 */
21 classes?: Partial<IconButtonClasses>;
22 /**
23 * The color of the component.
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 'default'
27 */
28 color?: OverridableStringUnion<
29 'inherit' | 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning',
30 IconButtonPropsColorOverrides
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 given, uses a negative margin to counteract the padding on one
44 * side (this is often helpful for aligning the left or right
45 * side of the icon with content above or below, without ruining the border
46 * size and shape).
47 * @default false
48 */
49 edge?: 'start' | 'end' | false;
50 /**
51 * The size of the component.
52 * `small` is equivalent to the dense button styling.
53 * @default 'medium'
54 */
55 size?: OverridableStringUnion<'small' | 'medium' | 'large', IconButtonPropsSizeOverrides>;
56 /**
57 * The system prop that allows defining system overrides as well as additional CSS styles.
58 */
59 sx?: SxProps<Theme>;
60}
61
62export type IconButtonTypeMap<
63 AdditionalProps = {},
64 RootComponent extends React.ElementType = 'button',
65> = ExtendButtonBaseTypeMap<{
66 props: AdditionalProps & IconButtonOwnProps;
67 defaultComponent: RootComponent;
68}>;
69
70/**
71 * Refer to the [Icons](https://mui.com/material-ui/icons/) section of the documentation
72 * regarding the available icon options.
73 *
74 * Demos:
75 *
76 * - [Button](https://mui.com/material-ui/react-button/)
77 *
78 * API:
79 *
80 * - [IconButton API](https://mui.com/material-ui/api/icon-button/)
81 * - inherits [ButtonBase API](https://mui.com/material-ui/api/button-base/)
82 */
83declare const IconButton: ExtendButtonBase<IconButtonTypeMap>;
84
85export type IconButtonProps<
86 RootComponent extends React.ElementType = IconButtonTypeMap['defaultComponent'],
87 AdditionalProps = {},
88> = OverrideProps<IconButtonTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
89 component?: React.ElementType;
90};
91
92export default IconButton;