Skip to content

Hero Video

Poster with a round play button over it; the whole frame plays and pauses.

From the Findit template — see it in context

The file is only fetched when you press play; the poster is all that loads before.

Installation

$ npx shadcn@latest add https://framebrick.co/r/hero-video.json

Usage

import { HeroVideo } from "@/components/ui/hero-video";

<HeroVideo src="/tour.mp4" poster="/tour.jpg" label="Play the tour of 14 Almond Street" />

Props

PropTypeDefaultDescription
srcstring—The video file.
posterstring—Shown before play and while paused.
labelstring—What the button does, e.g. "Play the tour of 14 Almond Street".
loopbooleantrueStart again when it ends.
mutedbooleantrueVideos start muted so a browser lets them play; turn it off for sound.
  • Nothing of the video is downloaded until someone presses play (preload="none") — only the poster.
  • The button follows the video, not the click, so it comes back when the video ends or is paused from anywhere else.
  • The whole frame is a button with aria-pressed, so a keyboard reaches it and the state is announced.

AI prompt

Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.

Create a React + Tailwind CSS + Motion (motion/react) component called HeroVideo.
- The whole frame is a button (aspect-video, rounded-lg, overflow-hidden, bg-muted, visible focus ring) holding a
  <video> with a poster, muted, loop, playsInline and preload="none", filling it with object-cover.
- A click plays or pauses. Keep a "playing" state from the video's own play, pause and ended events, not from the click.
- While paused, a 48px circle sits in the middle: bg-black/25 with backdrop-blur-md and a white play triangle.
  It rests at opacity 0.75 and goes to 1 on hover and on keyboard focus, with a spring (bounce 0, duration 0.4s).
- Accessibility: aria-label describing what plays, aria-pressed for the state.

Be the first to know

Get new templates and components first

One short email when we release a template or a free component. No spam — unsubscribe anytime.

We use your email only for Framebrick updates. Privacy policy