Skip to content

Content

Media

An image in a fixed frame: screenshots, device mockups and photos, framed or full-bleed.

  • Experimental
  • No keyboard interaction
  • Screen reader not tested yet

Playground

Change the props. The controls come from the documented props.
LVM contract management on a laptop: changing the insurance cover of a fleet
tsx
<Media
  src="/portfolio/cases/lvm-contract-management.webp"
  alt="LVM contract management on a laptop: changing the insurance cover of a fleet"
  width={1146}
  height={739}
/>

Usage

When to use

Use Media for every image in a screen or a pattern: case visuals, device mockups, screenshots, photos.

When not to use

  • For logos: use LogoStrip.
  • For icons: they belong inside the component that uses them.

How it works

The image sits in a frame with the card radius. ratio fixes the proportion so a row of images lines up; auto keeps the file's own. framed puts device mockups and cut-outs on the subtle surface, contained and padded; without it the image fills the frame. SVG files are served as they are, everything else through Next's image optimisation.

Content guidelines

Alt text says what the screen shows and why it matters (“DB Navigator Quick Booking on a phone: one swipe buys the ticket”), not “screenshot of …”. Trim transparent padding from mockups before use.

Do and don’t

Do
  • Trim transparent padding from mockups before use, so framed images line up.
  • Write alt text that says what the screen shows, not that it is a screenshot.
Don’t
  • Don't put text into images; it can't be read, translated or searched.

Anatomy

The parts of the component and what each one does, as in the playground above.
  1. containerCard radius; the subtle surface when framed.
  2. medianext/image, contained when framed, cover otherwise.

Examples

Type-checked, and the same code goes into the AI manifest. Import: import { Media } from "@/ds";

Framed mockup

LVM contract management on a laptop: changing the insurance cover of a fleet

Portrait mockup

DB Navigator Quick Booking on a phone: one swipe buys the ticket

Props

Checked against the component's TypeScript type on every build.
Media props
NameTypeDefaultDescription
src (required)string–Image file, ideally WebP, trimmed to its content.
alt (required)string–What the image shows. Empty only for decorative images.
width (required)number–Intrinsic width of the file.
height (required)number–Intrinsic height of the file.
ratio"auto" | "16/9" | "4/3" | "3/2" | "1/1""auto"Frame proportion; auto keeps the image's own.
framedbooleanfalseContained on the subtle panel with padding, for mockups and cut-outs.
focus"center" | "top""center"Which part stays visible when a cover image is cropped; top for page screenshots.
priorityboolean–Load first; only for the one image in the first screen.
sizesstring–Rendered width hint for responsive images.

Tokens used

Derived from the utility classes in the component's source. Copy a class with one click.
Tokens used by Media
TokenTierValueUtility
card.radiuscomponent16px
spacing.6semantic24px
spacing.8semantic32px
surface.subtlesemantic#E7E3DA

Accessibility

What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
Testing status by check
CheckHowStatus
axe-core rulesAutomated on every npm run check, at desktop and mobile widthRuns on every build
KeyboardAutomated Playwright test (scripts/keyboard.mjs)Not applicable
Screen readerManualNot tested yet

Semantics and focus

  • alt is required. Use an empty alt only for images that add nothing beyond the text next to them.