Skip to main content
OwnDocs

Embed

1 min readStableBeginner

The Embed component renders responsive iframes for YouTube, GitHub repositories, and GitHub Gists. Every iframe runs inside a sandbox that blocks script access to the host page.

Quick Start

Embed a video or repository.

MDX
MDX
<Embed url="https://www.youtube.com/watch?v=dQw4w9WgXcQ" title="Demo Video" />

Adding Options

Control the aspect ratio.

MDX
MDX
<Embed
  url="https://github.com/vercel/next.js"
  title="Next.js Repository"
  aspectRatio="4:3"
/>

Advanced

YouTube watch URLs are rewritten to privacy-enhanced youtube-nocookie.com embeds. GitHub hosts get allow-scripts allow-same-origin allow-popups allow-forms; all other hosts omit allow-same-origin so embedded content cannot reach the host page.

Options

urlstringrequired

The URL to embed.

titlestring

Accessible iframe title; defaults to "Embedded content".

aspectRatiostringDefault: 16:9

16:9, 4:3, or 1:1.

Was this page helpful?