UNPKG

@trail-ui/react

Version:
43 lines (40 loc) 1.41 kB
import * as react from 'react'; import { ImgHTMLAttributes } from 'react'; import { FallbackStrategy } from '@trail-ui/hooks'; interface BaseImageProps extends ImgHTMLAttributes<HTMLImageElement> { /** * Fallback image `src` to show if image is loading or image fails. */ fallbackSrc?: string; /** * Fallback element to show if image is loading or image fails. * @type React.ReactElement */ fallback?: React.ReactElement; /** * Defines loading strategy */ loading?: 'eager' | 'lazy'; /** * If `true`, opt out of the `fallbackSrc` logic and use as `img` * * @default false */ ignoreFallback?: boolean; /** * - beforeLoadOrError(default): loads the fallbackImage while loading the src * - onError: loads the fallbackImage only if there is an error fetching the src * * @default "beforeLoadOrError" * @see Issue https://github.com/chakra-ui/chakra-ui/issues/5581 */ fallbackStrategy?: FallbackStrategy; /** * Defining which referrer is sent when fetching the resource. * @type React.HTMLAttributeReferrerPolicy */ referrerPolicy?: React.HTMLAttributeReferrerPolicy; as?: React.ElementType; } declare const _BaseImage: react.ForwardRefExoticComponent<BaseImageProps & react.RefAttributes<HTMLImageElement>>; export { _BaseImage as BaseImage, BaseImageProps };