Docs
YouTube
YouTube
A responsive YouTube video component with privacy-focused embedding and loading states.
12 views
7 downloads
Loading...
Overview
The YouTube component provides a clean, responsive way to embed YouTube videos using the privacy-enhanced youtube-nocookie.com domain. It includes skeleton loading states and mobile-optimized autoplay behavior.
Installation
pnpm dlx shadcn@latest add https://deltacomponents.dev/r/youtube.json
Usage
1"use client"23import YouTube from "@/registry/media/youtube"45export function Component() {6 return (7 <div className="w-full max-w-2xl mx-auto">8 <YouTube videoId="0RXdd0pCJ9Q" />9 </div>10 )11}
API Reference
Parameters
Name | Type | Default | Description |
---|---|---|---|
videoId | string | - | The YouTube video ID (extracted from the video URL) |
className | string | "" | Additional CSS classes to apply to the container |
autoplay | boolean | false | Whether to autoplay the video (disabled on mobile) |
Features
- Privacy-focused: Uses youtube-nocookie.com for enhanced privacy
- Responsive: Maintains 16:9 aspect ratio across all screen sizes
- Loading states: Shows skeleton while video loads
- Mobile-optimized: Disables autoplay on mobile devices for better UX
- Accessible: Includes proper iframe attributes and titles