Skip to content
v0.2.10

Image

A native responsive image with explicit alternative text and media fitting.

Preview
Flood logo

Use Image

Image 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.tsxTSX
"use client";

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

export function Example() {
  return (
    <FloodRoot>
      <Image src="/flood-mark.png" alt="Flood logo" width={160} height={160} fit="contain" />
    </FloodRoot>
  );
}

Design notes

  • alt is required; an empty string is appropriate for decorative imagery beside equivalent visible content.
  • Native src/srcSet/sizes/loading/decoding/dimensions, handlers and HTMLImageElement ref are preserved. Supply width/height or AspectRatio to reserve geometry.
  • fit cover/contain changes object-fit, not fetching, optimization or fallback behavior. Avatar composes Image with its own load/fallback lifecycle.
  • Available in 0.2.4; use matching installed declarations.

API reference

PropValuesDefault
altstringRequired
fit"cover" | "contain""cover"
Native HTML propsOmit<ImgHTMLAttributes<HTMLImageElement>, "alt">Forwarded
View TypeScript source