Skip to content
Protocore Design Systemv1.6.9

/// Media

Image

An <img> wrapper with fixed or fill sizing, object-fit, a sharp fallback placeholder, and an optional caption.

import { Image } from "@protocore/pds";
View as Markdown

Basics

Image wraps a plain <img> with fixed width / height and an object-fit (default cover). Corners stay sharp. It's a thin, framework-agnostic wrapper — no lazy-loading magic, just consistent sizing and a fallback.

Protocore brand plate

Fallback

When src is absent or the image fails to load, Image swaps in a sharp placeholder box with a broken-image glyph and a mono label — no layout shift, no broken-image chrome. Pass a custom fallback node or a fallbackLabel to tune it.

Broken upload

Caption & fill

Add a caption to promote the wrapper to a semantic <figure> with a <figcaption>. Use fill (instead of width/height) to have the image cover a positioned parent — pair it with AspectRatio to lock the frame's ratio.

Settlement volume chart export
Q1–Q3 settlement volume, exported from the reconciliation dashboard.

When to use it

Image is the general-purpose picture primitive — product shots, screenshots, chart exports, uploaded media. For a *person's* picture with initials fallback, use Avatar; for a fixed-ratio frame, wrap Image fill in AspectRatio; for decorative brand line work, use LineArt.

The fallback is the point: an admin console renders user-supplied URLs that break, and a broken-image icon looks like a bug. Image degrades to a deliberate placeholder instead. alt is required — pass "" for purely decorative images so screen readers skip them.

Usage

Do

  • Always pass `alt` — a description, or `""` for decorative images.
  • Use the fallback for user-supplied URLs that may 404.
  • Wrap `fill` images in AspectRatio to reserve the space.

Don't

  • Don't use it for avatars — Avatar has the initials fallback.
  • Don't omit dimensions on a fixed image; reserve the space to avoid shift.
  • Don't round the corners; keep them sharp.

Accessibility

  • `alt` is a required prop — meaningful images describe themselves; decorative ones pass `alt=""`.
  • The fallback placeholder is a `role="img"` with the `alt` (or `fallbackLabel`) as its accessible name, so a missing image is still announced.
  • A `caption` renders inside a real `<figure>` / `<figcaption>`, associating the text with the image.

Image props

PropTypeDefaultDescription
alt *stringAlternative text. Required for meaningful images; pass `""` for decorative.
captionReactNodeCaption rendered under the image; promotes the wrapper to a `<figure>`.
classNamestring
fallbackReactNodeCustom fallback node shown when the image is missing or errors.
fallbackLabelstringNo imageMono label for the built-in placeholder (used when no `fallback` is given).
fillbooleanfalseFill the positioned parent (absolute inset:0) instead of using width/height.
fitenumcover`object-fit` for the rendered image.
heightstring | numberHeight — number (px) or any CSS length. Ignored when `fill`.
srcstringImage source. When absent or it fails to load, the fallback renders.
styleCSSProperties
widthstring | numberWidth — number (px) or any CSS length. Ignored when `fill`.

Related

  • AvatarSquare user image with a mono-initials fallback.
  • AspectRatioA box that locks its content to a fixed width-to-height ratio.
  • LineArtThe house generative imagery — hundreds of thin currentColor strokes.
  • IconSizing wrapper that scales any inline SVG icon to a token box.