Skip to content
v0.2.10

ImagePreview

A single-image preview in Flood Dialog with loading and failure feedback.

Preview

Flood mark

Use ImagePreview

ImagePreview is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
image-preview.tsxTSX
"use client";

import { FloodRoot, ImagePreview, Button } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <ImagePreview title="Flood mark" src="/flood-mark.png" alt="Pink Flood mark"
        trigger={props => <Button {...props} variant="subtle">Preview image</Button>} />
    </FloodRoot>
  );
}

Design notes

  • Loads the image only while its dialog content is mounted.
  • The host owns trusted URLs, object URL lifetime and download permissions.

API reference

PropValuesDefault
titlestringRequired
trigger(props: OverlayTriggerProps) => ReactNodeRequired
openboolean—
defaultOpenboolean—
onOpenChange(open: boolean) => void—
disabledboolean—
closeLabelstring—
closeOnOutsideClickboolean—
initialFocusRefRefObject<HTMLElement | null>—
srcstringRequired
altstringRequired
captionReactNode—
downloadHrefstring—
downloadLabelstring—
loadingLabelstring—
errorLabelstring—
Native HTML propsOmit<Omit<HTMLAttributes<HTMLDialogElement>, "children" | "title" | "role">, "children" | "description">Forwarded
View TypeScript source