kevingirelli

YouTube Embed

Component

About

A lazy-loading YouTube video embed that shows a poster image and play button until clicked, then loads the iframe and lets you control playback (play, pause, mute, seek) through a ref.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds YouTube Embed to your project and fits it to your theme.

Code

How YouTube Embed is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { YouTubeEmbed } from "@/components/ui/youtube-embed";

export default function YouTubeEmbedDemo() {
  return (
    <div className="w-full max-w-2xl mx-auto p-4">
      <YouTubeEmbed
        videoId="dQw4w9WgXcQ"
        title="Rick Astley - Never Gonna Give You Up"
      />
    </div>
  );
}

Dependencies

More by kevingirelli

View all
  • Aurora

    Aurora

    50
  • Warp Gradient

    Warp Gradient

    48
  • FAQ Section

    FAQ Section

    45
  • QR Code

    QR Code

    45
  • Wave Text

    Wave Text

    37
  • Corner Frame

    Corner Frame

    35
  • Animated Border

    Animated Border

    32
  • Spotlight

    Spotlight

    23