YouTube Embed
A YouTube video as a click-to-play facade. At rest it is only the video's thumbnail and a play button; YouTube's player (~500KB of script, plus its cookies) loads from the privacy-enhanced youtube-nocookie domain when the visitor presses play. Used as the Lab project hero and as the YouTube block in any Sanity body (blog posts, case studies, Lab projects).
Default
tsx
<YouTubeEmbed
url="https://www.youtube.com/watch?v=d5TxsqD-7Mw"
title="Usability Test MCP: usability tests right from Claude Code or Codex"
/>In Sanity
Add a YouTube video block to any body, or fill the Video field on a Lab project. Both take the URL and an optional title; Studio rejects links that aren't youtube.com or youtu.be.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
url* | string | - | Any YouTube link — watch, youtu.be, shorts or embed. Renders nothing if the link cannot be parsed. |
title | string | - | Video title. Names the play button ("Play video: …") and the player iframe for screen readers. |
priority | boolean | false | Loads the thumbnail eagerly. Set it when the video is above the fold (the Lab project hero). |
sizes | string | "(min-width: 1024px) 1040px, 100vw" | Thumbnail sizes hint; the default matches .article-column. |
className | string | - | Additional classes for the 16:9 frame |