Embeds & oEmbed
Embedding tweets, YouTube, Spotify, Loom, Figma, and link-preview cards.
Drop-in embed components (React)
- ★ react-tweet — Vercel-built, server-rendered tweets without the third-party JS / cookies. The default for tweets in 2026 (now Twitter / X has gated their JS embed for many use cases).
- react-youtube — YouTube iframe wrapper.
@vidstack/react— see Media Players; supports YouTube/Vimeo via the embed plugin.- react-player — universal wrapper for YouTube / Vimeo / SoundCloud / Twitch / direct files.
@socialgouv/matomo-next— analytics-friendly oEmbed wrapper.- react-spotify-embed, react-instagram-embed (deprecated), etc.
Generic oEmbed parsers
- ★ iframely / iframely-api — universal embed engine; self-host or hosted; supports thousands of providers.
- Embedly — paid; the original.
unfurl.js— parse OG tags / oEmbed from arbitrary URLs (server-side).metascraper— modular metadata scraper for link previews.open-graph-scraper— focused on OG tags.
Link preview cards (Slack-style)
- Build with
unfurl.jsormetascraper+ cache the response. - Render with a card component (shadcn/ui's
Card, etc.). - Avoid hammering target sites — cache aggressively, respect
robots.txtand rate limits.
"Embed your own app" patterns
- Iframe embed — most ergonomic; pair with Iframe Resizer for height auto-sizing.
- Shadow DOM widget — for sites that don't want iframes; ship a
<script>that mounts in shadow root. - Web Components — universal embeddable element, no framework lock-in.
Patterns to know
- Lazy-load iframes —
loading="lazy"reduces TTI for embed-heavy pages. - Privacy-first embeds — render a static preview, swap to real iframe on click. Helps GDPR consent flows (Cookie Consent).
- Server-render where possible —
react-tweetis the model. - Content Security Policy — embeds blow up CSP; allowlist specific origins.
Pick this if…
- Tweets in your blog or app: react-tweet.
- YouTube / video: react-player.
- Auto-handle 1000s of providers: iframely.
- Slack-style link previews:
unfurl.jsormetascraper+ your own card UI. - Embed your own app on customer sites: iframe + Iframe Resizer (simple) or Web Components (universal).