Components
Media
Screenshots and recordings on a write-up: one frame and caption for every picture, and three ways to show a video.
Usage
Media frame

Uses.ssr-loop.ssr-loop-still
import { DemoImage } from '@/components/ui/demo-image'
import { DemoVideo } from '@/components/ui/demo-video'
import { LoopVideo } from '@/components/ui/loop-video'
import { PlateVideo } from '@/components/ui/plate-video'
<figure>
<div className="aka-card-well aka-card-media overflow-hidden rounded-lg">
<DemoImage src="/blockpad/blockpad-hero.webp" alt="The Blockpad window" width={1600} height={1003} />
</div>
<figcaption className="mt-1.5 text-11 font-light text-muted-foreground/75">What the frame shows.</figcaption>
</figure>Every screenshot gets the same frame and caption, and the caption states what the frame shows, not that it is a screenshot. DemoImage serves quality 90, because these are pictures of interfaces, hairlines and small caps, the worst case for a lossy codec.
Examples
DemoVideo
<DemoVideo src="/ubik/search" poster="/ubik/search-poster.webp" width={1280} height={952} label="Ubik's search, scoring its own results" />A screen recording with controls: the poster until play, nothing fetched before it.
LoopVideo

<LoopVideo src="/ubik/marketing/home-hero" poster="/ubik/marketing/home-hero-poster.webp" width={1280} height={662} label="The Ubik home page headline" />A recording that plays itself and cannot be stopped: the interface moving on its own, with no control bar turning a picture of the product into a media player.
PlateVideo

<div className="aspect-[900/640] overflow-hidden rounded-lg">
<PlateVideo src="/wrdef/wrdef-card.mp4" poster="/wrdef/wrdef-card-poster.webp" width={900} height={640} label="Wrdef, mid-game" />
</div>A clip inside a plate, cut for the cell: seven seconds at 900px is 25 KB where the full capture is 1.28 MB.
Props
DemoImage
Server component
| Prop | Description |
|---|---|
srcstring | StaticImageData | A path under /public, or a static import, which brings its own blur. |
altstring | What the picture shows. |
width?number | Required for a path; a static import already knows its own. |
height?number | As width. |
sizes?string | The article's own measure, so a phone is not sent a desktop frame.Default '(min-width: 672px) 640px, 100vw' |
priority?boolean | Preload it: the largest picture above the fold. |
blur?boolean | The 16px blur-up before the bytes arrive. Off where a frame already has a ground of its own.Default true |
eager?boolean | Fetch on load rather than on approach, for a slide reached sideways. |
unoptimized?boolean | Serve the encoded file itself, skipping the optimiser. |
className?string | On the image. |
DemoVideo
Server component
| Prop | Description |
|---|---|
srcstring | Base path under /public, without extension. |
format?'mp4' | 'webm' | The container to serve.Default 'mp4' |
posterstring | Shown until play, and the only thing fetched on load. |
widthnumber | Intrinsic size, so the frame reserves its space. |
heightnumber | As width. |
labelstring | Describes the recording for anyone who cannot watch it. |
className?string | On the video.Default 'block h-auto w-full' |
LoopVideo
Server component
| Prop | Description |
|---|---|
srcstring | Base path under /public, without extension. |
posterstring | The still, which stands in under reduced motion. |
widthnumber | Intrinsic size, so the frame holds its shape before anything loads. |
heightnumber | As width. |
labelstring | What the recording shows. |
className?string | On the video and its still.Default 'block h-auto w-full' |
PlateVideo
Server component
| Prop | Description |
|---|---|
srcstring | The clip, cut for a plate. |
posterstring | The still, which stands in under reduced motion. |
labelstring | What the clip shows. |
widthnumber | Intrinsic size. |
heightnumber | As width. |
Best practices
When to use
- DemoImage for every screenshot on a write-up; DemoVideo when the reader should choose to watch; LoopVideo when the motion is the point; PlateVideo inside a project plate.
Behaviour
- All four are server components with no hooks; a page of recordings ships no JavaScript for its video.
- Under reduced motion the looping videos are hidden and their still stands in, chosen by the ssr-loop pair in CSS rather than by a script.
- Every one ships its intrinsic size, so nothing jumps as it loads (law 06).
Accessibility
- Images take alt text and videos a label that says what they show.
- The videos are muted and carry an empty captions track.
CSS
The rules, as globals.css has them, with the reasoning the stylesheet keeps beside them.
/*
* A looping clip's two states, decided in CSS rather than in JavaScript.
*
* Motion by default, the poster frame when the reader has asked their system
* for less. Doing the swap with a media query is what lets a card's video stay
* a server component: there is no moment where a script has to pick between
* the two, so neither waits for hydration.
*/
.ssr-loop-still {
display: none;
}
@media (prefers-reduced-motion: reduce) {
.ssr-loop {
display: none;
}
.ssr-loop-still {
display: block;
}
}