UNPKG

2.12 kBTypeScriptView Raw
1import * as React from 'react';
2import { StandardProps } from '..';
3
4export interface SvgIconProps
5 extends StandardProps<React.SVGProps<SVGSVGElement>, SvgIconClassKey, 'children'> {
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 component used for the root node.
17 * Either a string to use a DOM element or a component.
18 */
19 component?: React.ElementType<React.SVGProps<SVGSVGElement>>;
20 /**
21 * The fontSize applied to the icon. Defaults to 24px, but can be configure to inherit font size.
22 */
23 fontSize?: 'inherit' | 'default' | 'small' | 'large';
24 /**
25 * Applies a color attribute to the SVG element.
26 */
27 htmlColor?: string;
28 /**
29 * The shape-rendering attribute. The behavior of the different options is described on the
30 * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering).
31 * If you are having issues with blurry icons you should investigate this property.
32 * @document
33 */
34 shapeRendering?: string;
35 /**
36 * Provides a human-readable title for the element that contains it.
37 * https://www.w3.org/TR/SVG-access/#Equivalent
38 */
39 titleAccess?: string;
40 /**
41 * Allows you to redefine what the coordinates without units mean inside an SVG element.
42 * For example, if the SVG element is 500 (width) by 200 (height),
43 * and you pass viewBox="0 0 50 20",
44 * this means that the coordinates inside the SVG will go from the top left corner (0,0)
45 * to bottom right (50,20) and each unit will be worth 10px.
46 */
47 viewBox?: string;
48}
49
50export type SvgIconClassKey =
51 | 'root'
52 | 'colorSecondary'
53 | 'colorAction'
54 | 'colorDisabled'
55 | 'colorError'
56 | 'colorPrimary'
57 | 'fontSizeInherit'
58 | 'fontSizeSmall'
59 | 'fontSizeLarge';
60
61export default function SvgIcon(props: SvgIconProps): JSX.Element;