Hero Video Dialog

A poster with a play button that grows into the full video, and loads nothing until pressed.

Category
Marketing
Access
Free with an account
Source
185 lines · one file
States
4 drawn
Added
3 Nov 2026

The decision inside it

Nothing about the video loads with the page

Only the poster image loads at first. The player or iframe appears when someone presses play, and the connection to the video's host is warmed when the pointer comes near. Closing removes the player, so sound never carries on behind the page.

When to use it

Use Hero Video Dialog for a product video on a landing page: a poster that opens the video in a dialog without loading it up front.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Hero Video Dialog for this.
Install it: npx shadcn@latest add @liro/hero-video-dialog
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/hero-video-dialog.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/product-video.tsx
import { HeroVideoDialog } from "@/components/ui/hero-video-dialog";

export function ProductVideo() {
  return (
    <HeroVideoDialog
      poster="/video/tour.jpg"
      embed="https://www.youtube-nocookie.com/embed/VIDEO_ID"
      title="See Madgixs in a minute"
      duration="1:04"
      alt="The Madgixs dashboard"
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
posterstring YesThe still shown before playing.
srcstring NoA video file to play (mp4, webm).
embedstring NoOr an embed URL (YouTube, Vimeo). Autoplay is added.
titlestring NoShown on the poster and used as the dialog's name.
durationstring No"0:34", shown on the poster.
altstring NoPoster image description.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-theme

States

All of them are drawn by the component. None is left for you to design.

  • Poster
  • Hover
  • Playing
  • Closed

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances