UNPKG

2.46 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { OverridableStringUnion } from '@mui/types';
4import { Theme } from '../styles';
5import { OverridableComponent, OverrideProps } from '../OverridableComponent';
6import { IconClasses } from './iconClasses';
7
8export interface IconPropsSizeOverrides {}
9
10export interface IconPropsColorOverrides {}
11
12export interface IconOwnProps {
13 /**
14 * The base class applied to the icon. Defaults to 'material-icons', but can be changed to any
15 * other base class that suits the icon font you're using (for example material-icons-rounded, fas, etc).
16 * @default 'material-icons'
17 */
18 baseClassName?: string;
19 /**
20 * The name of the icon font ligature.
21 */
22 children?: React.ReactNode;
23 /**
24 * Override or extend the styles applied to the component.
25 */
26 classes?: Partial<IconClasses>;
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 'inherit'
32 */
33 color?: OverridableStringUnion<
34 | 'inherit'
35 | 'action'
36 | 'disabled'
37 | 'primary'
38 | 'secondary'
39 | 'error'
40 | 'info'
41 | 'success'
42 | 'warning',
43 IconPropsColorOverrides
44 >;
45 /**
46 * The fontSize applied to the icon. Defaults to 24px, but can be configure to inherit font size.
47 * @default 'medium'
48 */
49 fontSize?: OverridableStringUnion<
50 'inherit' | 'large' | 'medium' | 'small',
51 IconPropsSizeOverrides
52 >;
53 /**
54 * The system prop that allows defining system overrides as well as additional CSS styles.
55 */
56 sx?: SxProps<Theme>;
57}
58
59export interface IconTypeMap<
60 AdditionalProps = {},
61 RootComponent extends React.ElementType = 'span',
62> {
63 props: AdditionalProps & IconOwnProps;
64 defaultComponent: RootComponent;
65}
66/**
67 *
68 * Demos:
69 *
70 * - [Icons](https://mui.com/material-ui/icons/)
71 * - [Material Icons](https://mui.com/material-ui/material-icons/)
72 *
73 * API:
74 *
75 * - [Icon API](https://mui.com/material-ui/api/icon/)
76 */
77declare const Icon: OverridableComponent<IconTypeMap> & { muiName: string };
78
79export type IconProps<
80 RootComponent extends React.ElementType = IconTypeMap['defaultComponent'],
81 AdditionalProps = {},
82> = OverrideProps<IconTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
83 component?: React.ElementType;
84};
85
86export default Icon;