---
title: "Media"
description: "Add images, video with cues, Lottie animations and icons to a slide."
---

> Documentation Index
> Fetch the complete documentation index at: https://sandrinodm.github.io/deckster/llms.txt
> Use this file to discover all available pages before exploring further.

# Media

Add photos, screenshots, video cut into steps, small animations and icons to a slide, and put a picture behind a whole slide. The brand decides how pictures are treated, so the same slide fits every brand.

## Where a path points

Every file path a slide names, in `src`, `poster`, `posters`, `fallback`, a Markdown image or `background:`, starts from one of three places, decided by how it begins:

| Written as | Starts from |
| --- | --- |
| `assets/harbour.png` (bare) | The deck folder. |
| `/harbour.png` | The deck's `public/` folder. The file is served as it is, not imported. |
| `./harbour.png` or `../assets/harbour.png` | The folder of the slide file, so `../` from `slides/` reaches the deck folder. |

The file, with links followed, must be inside the deck folder (inside `public/` for a `/` path) and be of the prop's kind; anything else fails the build. A path to a file that does not exist does not stop the build: `deck lint` reports it as `media-missing` and names the path it looked for. A web address (`https://...`) is left as it is.

## Add an image

A Markdown image alone in its paragraph becomes an `<Image>`. Write `<Image>` when you need its props:

[Live slide: "One register for every street tree", slide 6 of the components deck](https://sandrinodm.github.io/deckster/decks/components/#/register)

`decks/components/slides/register.mdx`:

```mdx
---
layout: split
title: One register for every street tree
eyebrow: The data
surface: inverse
side: left
ratio: 5:7
budget: 1m
---

Every tree the city plants gets a record the day it goes in.

- <Icon name="trees" role="accent" /> 212,000 trees, one record each
- <Icon name="map-pin" role="accent" /> Located to within two metres
- <Icon name="database" role="accent" /> Updated by crews from a phone

<Media>
  <Image
    src="../assets/street.jpg"
    alt="A residential street under a full summer canopy of mature maples"
    focal={[50, 30]}
  />
</Media>

<Caption>Westgate, July 2026. CC0 photo from [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Tree-lined_street_in_Westgate.jpg).</Caption>

<Notes>
The photo takes the brand's image treatment: rounded corners in the default brand, a duotone in Nocturne. The treatment comes from the brand file, not from this slide.

The record count is illustrative; the point is one record per tree.
</Notes>
```

| Prop | What it does |
| --- | --- |
| `src`, `alt` | The file ([where a path points](#where-a-path-points)) and what it shows (`alt=""` only for decoration). Both required. |
| `treatment` | A treatment from the brand's imagery, such as its duotone. `plain`, which every brand has, shows the image as it is: use it for screenshots and maps. Default: the slide's treatment, else the brand's. |
| `fit` | `cover` (default) crops to fill the frame; `contain` shows all of it. |
| `focal` | The point cropping keeps in view, such as `focal="top"` or `focal={[50, 30]}` (percent across and down). Default: the centre. |
| `ratio` | The frame's width over height. |
| `caption` | A caption under the image. |

Pictures go in a layout's `<Media>` slot. Four layouts have one: `title` and `section` (a photo that bleeds off the right edge), `split` (beside the text) and `image` (the whole slide). The brand's treatments and imagery are on [fonts and assets](https://sandrinodm.github.io/deckster/brands/fonts-and-assets/).

**Text over a photo** belongs to the `image` layout, or a `title` cover with `picture: full`: they set the text in white on a dark scrim sized to it, and `deck lint` checks the contrast against the pixels underneath. Do not place text over a picture by hand.

*Slide still: A photo of a residential street under tall maples fills the whole slide; the eyebrow, the title 'Text over a photo stays readable' and a line of text sit in light type at the bottom left, and a photo credit sits at the bottom right.* [Open the slide](https://sandrinodm.github.io/deckster/decks/showcase/#/photo)

## What gets checked

| Rule | When |
| --- | --- |
| `media-missing` | A file named in `src`, `poster` or another media prop does not exist. An error. |
| `broken-image` | An image fails to load in the browser. An error. |
| `low-res-image` | A raster image has fewer pixels than the size it is drawn at on the 1920x1080 canvas. A warning. |
| `media-gif` | A local GIF that cannot be converted to video because `ffmpeg` is not installed. With `ffmpeg`, the build converts it. |

```console
$ deck lint launch-review
decks/launch-review/slides/harbour-map.mdx
  warning low-res-image (harbour-map step 0): harbour-map.png is 320x180 pixels but is drawn at 816x856 canvas pixels.
          Fix: Use an image at least 816x856 pixels (twice that for 2x exports), an SVG, or draw it smaller.

launch-review: 0 errors, 1 warning in 4 slides (4 steps checked).
```

## Add video and cut it into steps

`<Video>` plays when its slide appears and pauses when the deck leaves. Use WebM. `poster` is required: static mode, `deck shot` and exports show it instead of the video.

`cues` cut the video into parts, one per step: the first part plays on arrival and holds, and each press plays the next. Stepping back plays a part again from its start. Give one still per part in `posters`, so each step exports as its own picture; without them every step shows `poster` and `deck lint` warns with `video-cue-posters`.

[Live slide: "Watch a deploy in three beats", slide 2 of the components deck](https://sandrinodm.github.io/deckster/decks/components/#/video-cues)

`decks/components/slides/video-cues.mdx`:

```mdx
---
layout: split
title: Watch a deploy in three beats
eyebrow: Demo
ratio: 5:7
budget: 1m30s
---

- <Icon name="rocket" role="accent" /> Build finishes in under a minute
- <Icon name="shield-check" role="accent" /> Checks pass before traffic moves
- <Icon name="history" role="accent" /> Rolling back takes one command

<Media>
  <Video
    src="../assets/aurora.webm"
    poster="../assets/aurora-poster.jpg"
    posters={['../assets/aurora-part-1.jpg', '../assets/aurora-part-2.jpg', '../assets/aurora-part-3.jpg']}
    alt="A slow wash of color moving across the screen from left to right"
    cues={[0, 3, 6]}
    loop
  />
</Media>

<Caption>Press next to play each beat. Made for this deck.</Caption>

<Notes>
The video starts by itself when the slide appears, plays the first beat and holds. Each press plays the next three seconds.

If the room is loud, nothing is lost: it has no sound.
</Notes>
```

Video is muted by default (`muted={false}` to hear it); `loop`, `controls`, `fit`, `focal` and `caption` work as on `<Image>`. Inside a `<Step>`, a video starts from the top when the step reveals it.

## Add a Lottie animation

`<Lottie src alt>` plays a small vector animation from a Lottie JSON file, such as a check mark drawing itself. On its own it plays as the slide arrives; inside a `<Step>` it plays when the step reveals it. `role` draws every stroke and fill in one colour of the surface, so the animation follows the brand. Static mode shows its last frame (`frame` changes that).

```mdx
<Media>

<Lottie src="../assets/media/check.json" alt="A ring and a check mark drawing themselves: the handover confirmation" size="full" role="accent" />

</Media>
```

*Slide still: A split slide with a large green ring and check mark on the left, and the title 'Every handover ends with a check' with a line of text on the right.* [Open the slide](https://sandrinodm.github.io/deckster/decks/lookbook/#/split-lottie)

## Use icons

`<Icon name>` draws an icon from the brand's icon set, at the size of the text around it. `role="accent"` colours it; `label` gives it a text alternative, and without one it is decorative. Layout fields named `icon`, such as each card's `icon` on the `cards` layout, take the same names.

Find a name from the terminal:

```console
$ deck icons --search rocket
1 icon names matching "rocket" in every one of: default (lucide)
Sets: lucide

rocket
```

`deck icons` lists the names every brand in the workspace shares. A name the set does not have fails the build with the closest ones:

```console
$ deck lint launch-review
decks/launch-review/slides/icon.mdx
  error   schema (icon): Line 6, column 3: <Icon name="rockett"> is not an icon of the lucide set.
          Fix: Closest names in the lucide set: rocket, pocket, brackets, ticket, tickets. Browse the set at https://icon-sets.iconify.design/lucide/. A deck that renders in several brands needs a name that every brand's set has.

launch-review: 1 error, 0 warnings.
```

The names the published brands share are on [icons](https://sandrinodm.github.io/deckster/reference/icons/).

## Put a picture behind a whole slide

`background:` in the frontmatter paints an image over the slide's surface colour, behind everything else. Give a path:

```mdx
---
layout: statement
title: Harbour
surface: inverse
background: ../assets/harbour.png
---
```

or an object with options:

```mdx
---
layout: statement
title: Harbour at night
surface: inverse
background:
  src: ../assets/harbour.png
  fit: cover
  focal: { x: 50, y: 30 }
  tint: { role: bg, opacity: 0.6 }
  layers: over
---
```

`fit` and `focal` work as on `<Image>` (`focal` in percent, 0 to 100), `opacity` fades the image, `tint` lays a colour role of the surface over it (`bg`, `surface`, `fg` or `accent`, at an `opacity`) so text stays readable in every brand, and `layers: over` paints the image above the surface's own background layers instead of hiding them (`replace`, the default).

`background: none` hides the surface's background layers and paints no image. Every slide frontmatter key is on [slide frontmatter](https://sandrinodm.github.io/deckster/reference/slide-frontmatter/).

## In static mode and exports

Static mode, `deck shot` and exports never play video or animation: they show the posters, and a Lottie's chosen frame. See [static mode and readiness](https://sandrinodm.github.io/deckster/concepts/static-mode-and-readiness/). Buttons, link cards and QR codes are on [links](https://sandrinodm.github.io/deckster/write-slides/links/); every media prop is on [components](https://sandrinodm.github.io/deckster/reference/components/#props-Image).

Source: https://sandrinodm.github.io/deckster/write-slides/media/index.mdx
