Skip to main content

Exported Types

react-pro-image is written in TypeScript and exports all of its public types. You can import these types directly to annotate your own components, utility functions, or wrapper abstractions.

import type {
OptimizedImageProps,
AutoFormatConfig,
ImageWithFormatsProps,
UseImageLoaderOptions,
UseInViewOptions,
ImageLoadState,
} from "react-pro-image";

Type Reference

TypeDescription
OptimizedImagePropsThe complete prop type for the OptimizedImage component. Extends HTMLDivElement attributes with source, placeholder, fallback, and behavior props.
AutoFormatConfigConfiguration object for CDN format negotiation. Contains the formatKey and an ordered formats array. See AutoFormatConfig.
ImageWithFormatsPropsProps for the internal format-resolving image renderer. Useful if you are building a custom image component on top of the format detection logic.
UseImageLoaderOptionsOptions accepted by the useImageLoader hook, including source URLs, format config, and the isInView trigger flag.
UseInViewOptionsOptions accepted by the useInView hook, including threshold and rootMargin for IntersectionObserver configuration.
ImageLoadStateA string union type representing the four possible loading states: "idle", "loading", "loaded", or "error".