---
title: "Text Media"
description: "A photo or a looping video plays inside the letters of a heading, and the heading stays real, selectable text."
url: https://gelatinui.com/components/text-media
markdown_url: https://gelatinui.com/components/text-media.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/text-media"
version: "2026-11-14"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Text Media

> A photo or a looping video plays inside the letters of a heading, and the heading stays real, selectable text.

Page: https://gelatinui.com/components/text-media

## When to use it

Best for: One or a few large, bold words of a hero or section heading, with a photo or a short muted clip inside the letters.

- Use `image` alone for a still photo: it is CSS only, so the server HTML shows it.
- Add `video` for motion, and keep `image` as the still that shows until the first frame and when the video fails.
- Set `focalPoint` to keep the important part of the photo inside the letters when the text crops it.
- Use a heavy weight (`font-black`) at a display size, so the letters are wide enough to show the picture.

## When not to use it

- For a picture or a section that opens through a shape as the page scrolls, use [Mask Reveal](https://gelatinui.com/components/mask-reveal.md).
- For body text or a small label, plain text reads better; use [Typography](https://gelatinui.com/components/typography.md).

## Notes for agents

- Put Media Text inside the heading element (`h1`, `h2`): it renders a `span`, and its text stays real text that people can select and search.
- `image` is a CSS background cut to the letters (`background-clip: text`). Under it lies a layer in the text color, so a picture that fails to load leaves readable text.
- `video` is muted, looped, and inline. A canvas over the text draws each new frame cut to the real glyphs, so the cut follows the page font, line breaks, letter spacing, `text-transform`, and right-to-left text.
- The video plays only while it shows: it stops off screen, in a hidden tab, on hover, and while keyboard focus is on a link around it. Set `pauseOnHover={false}` to keep it playing under the mouse.
- `paused` and `onPausedChange` let the page own the pause. When the browser blocks autoplay, the item pauses and calls `onPausedChange(true)`, so the page can start it on a press.
- A video that fails sets `data-failed` and keeps `image`. A video that drew its first frame sets `data-live`.
- `focalPoint` is `{ x, y }` from 0 to 1. Default `{ x: 0.5, y: 0.5 }`, the center.
- Color emoji show as a square of the picture: the browser cuts the picture to the emoji box, not to its shape.

## Anatomy

```text
TextMedia
```

## API reference

### TextMedia

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `paused` | `boolean` |  | The pause of the user or the page (controlled). |
| `defaultPaused` | `boolean` |  | The first pause when `paused` is not given (uncontrolled). Default false. |
| `onPausedChange` | `function` |  | Called when the pause changes. |
| `pauseOnHover` | `boolean` |  | Hold the motion while a mouse is over the item, or keyboard focus is on the link or button around it (or in it). Default true. |
| `children` | `ReactNode` |  | The text. It stays real text: selectable, found by search, read by screen readers. |
| `image` | `string` |  | A picture inside the letters. With `video`, it is the still frame (the poster). |
| `video` | `string` |  | A video inside the letters: muted, looped, and inline. It plays only on screen. |
| `focalPoint` | `MediaTextFocalPoint` | MEDIA_TEXT_CENTER | The point of the picture that stays in view when it is cropped, 0 to 1. Default the center. |
| `locale` | `string` |  | The BCP 47 locale of the text, for the letter split and the case of `text-transform`. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| TextMedia | `text-media` | `data-live` | `--foreground`, `--media-text-image`, `--media-text-position` |  |

## Usage

Put it inside the heading of a hero. The image shows at once; the video takes over at its first frame.

The sample also uses `button`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui-pro/text-media @gelatin-ui/button
```

```tsx title="film-hero.tsx"
import { TextMedia } from "@/components/pro/text/text-media";
import { Button } from "@/components/ui/button";

export function FilmHero() {
  return (
    <section className="mx-auto flex max-w-3xl flex-col items-center gap-4 px-4 py-16 text-center">
      <p className="text-sm font-medium text-muted-foreground">Evening ride, 2026</p>
      <h1 className="text-7xl font-black tracking-tighter sm:text-8xl">
        <TextMedia
          video="/films/evening-ride.mp4"
          image="/films/evening-ride-poster.jpg"
          focalPoint={{ x: 0.5, y: 0.4 }}
        >
          Own the street
        </TextMedia>
      </h1>
      <p className="max-w-md text-muted-foreground">
        A short film about one rider, one wall, and the last light of the day.
      </p>
      <Button>Watch the film</Button>
    </section>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/text-media
```

It adds 28 registry items: 28 files, 3348 lines, and the npm packages `@mantine/hooks`, `clsx`, `motion`, `tailwind-merge`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Mask Reveal](https://gelatinui.com/components/mask-reveal.md)
- [Image](https://gelatinui.com/components/image.md)
- [Typography](https://gelatinui.com/components/typography.md)

## Motion

| Part | Motion |
| --- | --- |
| Video | none · the clip plays at its own frame rate; each new frame draws once into the canvas, cut to the letters |
| Stop and start | none · the video stops at once off screen, in a hidden tab, or on hover, and goes on from the same frame |
