UNPKG

2.56 kBTypeScriptView Raw
1import * as React from 'react';
2import { OverridableComponent, OverrideProps } from '../OverridableComponent';
3
4export interface SvgIconTypeMap<P = {}, D extends React.ElementType = 'svg'> {
5 props: P & {
6 /**
7 * Node passed into the SVG element.
8 */
9 children?: React.ReactNode;
10 /**
11 * The color of the component. It supports those theme colors that make sense for this component.
12 * You can use the `htmlColor` prop to apply a color attribute to the SVG element.
13 */
14 color?: 'inherit' | 'primary' | 'secondary' | 'action' | 'disabled' | 'error';
15 /**
16 * The fontSize applied to the icon. Defaults to 24px, but can be configure to inherit font size.
17 */
18 fontSize?: 'default' | 'inherit' | 'large' | 'medium' | 'small';
19 /**
20 * Applies a color attribute to the SVG element.
21 */
22 htmlColor?: string;
23 /**
24 * The shape-rendering attribute. The behavior of the different options is described on the
25 * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering).
26 * If you are having issues with blurry icons you should investigate this prop.
27 * @document
28 */
29 shapeRendering?: string;
30 /**
31 * Provides a human-readable title for the element that contains it.
32 * https://www.w3.org/TR/SVG-access/#Equivalent
33 */
34 titleAccess?: string;
35 /**
36 * Allows you to redefine what the coordinates without units mean inside an SVG element.
37 * For example, if the SVG element is 500 (width) by 200 (height), and you pass viewBox="0 0 50 20",
38 * this means that the coordinates inside the SVG will go from the top left corner (0,0)
39 * to bottom right (50,20) and each unit will be worth 10px.
40 */
41 viewBox?: string;
42 };
43 defaultComponent: D;
44 classKey: SvgIconClassKey;
45}
46/**
47 *
48 * Demos:
49 *
50 * - [Icons](https://material-ui.com/components/icons/)
51 * - [Material Icons](https://material-ui.com/components/material-icons/)
52 *
53 * API:
54 *
55 * - [SvgIcon API](https://material-ui.com/api/svg-icon/)
56 */
57declare const SvgIcon: OverridableComponent<SvgIconTypeMap>;
58
59export type SvgIconClassKey =
60 | 'root'
61 | 'colorSecondary'
62 | 'colorAction'
63 | 'colorDisabled'
64 | 'colorError'
65 | 'colorPrimary'
66 | 'fontSizeInherit'
67 | 'fontSizeSmall'
68 | 'fontSizeLarge';
69
70export type SvgIconProps<
71 D extends React.ElementType = SvgIconTypeMap['defaultComponent'],
72 P = {}
73> = OverrideProps<SvgIconTypeMap<P, D>, D>;
74
75export default SvgIcon;