Skip to content

Lite YouTube

YouTube thumbnail and play button; the player only loads on the click.

From the Findit template — see it in context

Nothing is loaded from YouTube until you press play — the still is served from here.

Installation

$ npx shadcn@latest add https://framebrick.co/r/lite-youtube.json

Usage

import { LiteYouTube } from "@/components/ui/lite-youtube";

<LiteYouTube url="https://www.youtube.com/watch?v=YE7VzlLtp-4" title="Big Buck Bunny" />

Props

PropTypeDefaultDescription
urlstring—A YouTube URL (watch, youtu.be, embed, shorts) or the bare video id.
titlestring—The video's title: read to screen readers and used as the player's title.
playLabelstring"Play"Word before the title in the button's label.
thumbnail"sd" | "hq" | "max""sd"Thumbnail quality; max is sharper but missing on some videos.
posterstring—Your own still instead of YouTube's thumbnail, so nothing is requested from YouTube before the click.
  • A YouTube iframe pulls about a megabyte before anyone watches; this pulls one image.
  • The player comes from youtube-nocookie.com, so YouTube sets no cookie until someone presses play. The default still does come from YouTube's image host — pass `poster` to serve your own and keep the page free of YouTube until the click (this demo does).
  • The play button is YouTube's own: dark grey at 80%, red on hover and on keyboard focus.

AI prompt

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

Create a React + Tailwind CSS component called LiteYouTube (no animation library) — a facade for a YouTube embed.
- Read the video id from a YouTube URL (watch, youtu.be, embed, shorts) or accept the bare id.
- Before the click: a 16:9 rounded-lg frame with the thumbnail from https://i.ytimg.com/vi_webp/<id>/sddefault.webp
  (plain <img>, object-cover) inside a button that fills the frame, labelled "<playLabel>: <title>".
  A "poster" prop replaces that URL with the caller's own image, so nothing is requested from YouTube before the click.
- On top, YouTube's own play button: an svg with viewBox "0 0 68 48", the rounded-rectangle path filled #212121 at
  80% opacity turning #f00 at 100% on hover and on keyboard focus (transition 100ms cubic-bezier(0.4,0,1,1)),
  with the white triangle "M 45,24 27,14 27,34".
- After the click, replace it with an iframe from https://www.youtube-nocookie.com/embed/<id> with
  autoplay=1&rel=0&modestbranding=1&iv_load_policy=3&playsinline=1, allowFullScreen, a title, and the usual allow list.
- Visible focus ring (ring-[3px] ring-ring/50 inset).

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