UNPKG

3.27 kBTypeScriptView Raw
1import * as React from "react";
2import { IconName } from "@blueprintjs/icons";
3import { AbstractPureComponent2, IntentProps, MaybeElement, Props } from "../../common";
4export type { IconName };
5export declare enum IconSize {
6 STANDARD = 16,
7 LARGE = 20
8}
9export declare type IconProps = IIconProps;
10/** @deprecated use IconProps */
11export 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 * @deprecated use size prop instead
44 */
45 iconSize?: number;
46 /**
47 * Size of the icon, in pixels. Blueprint contains 16px and 20px SVG icon
48 * images, and chooses the appropriate resolution based on this prop.
49 *
50 * @default IconSize.STANDARD = 16
51 */
52 size?: number;
53 /** CSS style properties. */
54 style?: React.CSSProperties;
55 /**
56 * HTML tag to use for the rendered element.
57 *
58 * @default "span"
59 */
60 tagName?: keyof JSX.IntrinsicElements;
61 /**
62 * Description string. This string does not appear in normal browsers, but
63 * it increases accessibility. For instance, screen readers will use it for
64 * aural feedback.
65 *
66 * If this value is nullish, `false`, or an empty string, the component will assume
67 * that the icon is decorative and `aria-hidden="true"` will be applied.
68 *
69 * @see https://www.w3.org/WAI/tutorials/images/decorative/
70 */
71 title?: string | false | null;
72}
73/**
74 * Icon component.
75 *
76 * @see https://blueprintjs.com/docs/#core/components/icon
77 */
78export declare class Icon extends AbstractPureComponent2<IconProps & Omit<React.HTMLAttributes<HTMLElement>, "title">> {
79 static displayName: string;
80 render(): JSX.Element | null;
81 /** Render `<path>` elements for the given icon name. Returns `null` if name is unknown. */
82 private renderSvgPaths;
83}