UNPKG

1.1 kBTypeScriptView Raw
1import { BoxProps } from "../Box";
2import * as React from "react";
3
4interface IImage {
5 /**
6 * The path to the image source
7 */
8 src?: string;
9 /**
10 * In event there was an error loading the `src`, specify a fallback
11 * In most cases, this can be an avatar or image placeholder
12 */
13 fallbackSrc?: string;
14 /**
15 * The alt text that describes the image
16 */
17 alt?: string;
18 /**
19 * A callback for when the image `src` has been loaded
20 */
21 onLoad?: () => void;
22 /**
23 * A callback for when there was an error loading the image `src`
24 */
25 onError?: () => void;
26 /**
27 * The native HTML `width` attribute to the passed to the `img`
28 */
29 htmlWidth?: string | number;
30 /**
31 * The native HTML `height` attribute to the passed to the `img`
32 */
33 htmlHeight?: string | number;
34 /**
35 * Defines loading strategy
36 */
37 loading?: "eager" | "lazy";
38 /**
39 * Opt out of the `fallbackSrc` logic and use the `Image` directly
40 */
41 ignoreFallback?: boolean;
42}
43
44export type ImageProps = IImage & BoxProps;
45
46declare const Image: React.FC<ImageProps>;
47
48export default Image;