1 | import * as React from "react";
|
2 | import { IconName } from "@blueprintjs/icons";
|
3 | import { AbstractPureComponent2, IntentProps, Props, MaybeElement } from "../../common";
|
4 | export { IconName };
|
5 | export declare enum IconSize {
|
6 | STANDARD = 16,
|
7 | LARGE = 20
|
8 | }
|
9 | export declare type IconProps = IIconProps;
|
10 | /** @deprecated use IconProps */
|
11 | export interface IIconProps extends IntentProps, Props {
|
12 | /** This component does not support custom children. Use the `icon` prop. */
|
13 | children?: never;
|
14 | /**
|
15 | * Color of icon. This is used as the `fill` attribute on the `<svg>` image
|
16 | * so it will override any CSS `color` property, including that set by
|
17 | * `intent`. If this prop is omitted, icon color is inherited from
|
18 | * surrounding text.
|
19 | */
|
20 | color?: string;
|
21 | /**
|
22 | * String for the `title` attribute on the rendered element, which will appear
|
23 | * on hover as a native browser tooltip.
|
24 | */
|
25 | htmlTitle?: string;
|
26 | /**
|
27 | * Name of a Blueprint UI icon, or an icon element, to render. This prop is
|
28 | * required because it determines the content of the component, but it can
|
29 | * be explicitly set to falsy values to render nothing.
|
30 | *
|
31 | * - If `null` or `undefined` or `false`, this component will render nothing.
|
32 | * - If given an `IconName` (a string literal union of all icon names), that
|
33 | * icon will be rendered as an `<svg>` with `<path>` tags. Unknown strings
|
34 | * will render a blank icon to occupy space.
|
35 | * - If given a `JSX.Element`, that element will be rendered and _all other
|
36 | * props on this component are ignored._ This type is supported to
|
37 | * simplify icon support in other Blueprint components. As a consumer, you
|
38 | * should avoid using `<Icon icon={<Element />}` directly; simply render
|
39 | * `<Element />` instead.
|
40 | */
|
41 | icon: IconName | MaybeElement;
|
42 | /**
|
43 | * Size of the icon, in pixels. Blueprint contains 16px and 20px SVG icon
|
44 | * images, and chooses the appropriate resolution based on this prop.
|
45 | *
|
46 | * @default IconSize.STANDARD = 16
|
47 | */
|
48 | iconSize?: number;
|
49 | /** CSS style properties. */
|
50 | style?: React.CSSProperties;
|
51 | /**
|
52 | * HTML tag to use for the rendered element.
|
53 | *
|
54 | * @default "span"
|
55 | */
|
56 | tagName?: keyof JSX.IntrinsicElements;
|
57 | /**
|
58 | * Description string. This string does not appear in normal browsers, but
|
59 | * it increases accessibility. For instance, screen readers will use it for
|
60 | * aural feedback. By default, this is set to the icon's name. Pass an
|
61 | * explicit falsy value to disable.
|
62 | */
|
63 | title?: string | false | null;
|
64 | }
|
65 | export declare class Icon extends AbstractPureComponent2<IconProps & Omit<React.HTMLAttributes<HTMLElement>, "title">> {
|
66 | static displayName: string;
|
67 | /** @deprecated use IconSize.STANDARD */
|
68 | static readonly SIZE_STANDARD = IconSize.STANDARD;
|
69 | /** @deprecated use IconSize.LARGE */
|
70 | static readonly SIZE_LARGE = IconSize.LARGE;
|
71 | render(): JSX.Element | null;
|
72 | /** Render `<path>` elements for the given icon name. Returns `null` if name is unknown. */
|
73 | private renderSvgPaths;
|
74 | }
|