Skip to main content

Overview

The Embed plugin provides a universal solution for embedding external content from various platforms. It supports video providers, social media, code sandboxes, music services, and maps — all with automatic URL detection and proper aspect ratio handling.

Installation

Basic Usage

Pass the plugin to createYooptaEditor; do not pass plugins to <YooptaEditor>.

Features

  • Universal Embedding: Embed content from 13+ platforms with a single plugin
  • Auto URL Detection: Automatically detects provider from pasted URLs
  • Provider-specific Aspect Ratios: Each provider uses its optimal aspect ratio
  • Resizable: Resize embeds while maintaining aspect ratio
  • oEmbed Support: Fetches metadata from providers that support oEmbed
  • Responsive: Automatically adapts to container width

Supported Providers

YouTube

Videos, Shorts

Vimeo

Videos

Twitter/X

Tweets, Posts

Instagram

Posts, Reels

Spotify

Tracks, Albums, Playlists

SoundCloud

Tracks, Sets

Figma

Files, Prototypes

CodePen

Pens

CodeSandbox

Sandboxes

Loom

Videos

Dailymotion

Videos

Wistia

Videos

Google Maps

Maps, Places

Configuration

Options

number
default:"650"
Maximum width for embedded content in pixels
object
Default dimensions for embeds when aspect ratio cannot be determined

Element Props

object | null
Provider information for the embedded content:
object
Embed dimensions: { width: number, height: number }

Provider Types

Commands

Utility Functions

The Embed plugin exports utility functions for working with embed URLs:

URL Patterns

Each provider supports specific URL patterns:

YouTube

Vimeo

Twitter/X

Instagram

Spotify

Figma

CodePen

CodeSandbox

Hooks

useEmbedUrl

Parse URLs and fetch oEmbed data:

Custom Rendering

With Shadcn Theme

Parsers

HTML Deserialization

The plugin automatically deserializes <iframe> elements with supported URLs:
It also handles divs with the data-yoopta-embed attribute:

HTML Serialization

Markdown Serialization

Embeds are serialized as links in Markdown:

Email Serialization

For email clients that don’t support iframes, embeds are rendered as clickable thumbnails (when available) or placeholder links:

Aspect Ratios

Each provider has its optimal aspect ratio:

Use Cases

Blog Posts

Embed YouTube tutorials, Spotify playlists, or tweets

Documentation

Include Figma designs, CodePen demos, or Loom walkthroughs

Portfolio

Showcase Vimeo videos, Dribbble shots, or CodeSandbox projects

Social Content

Embed Instagram posts, Twitter threads, or TikTok videos

Music & Audio

Include Spotify tracks, SoundCloud sets, or podcast episodes

Development

Share CodePen experiments, CodeSandbox demos, or GitHub gists

Best Practices

Choose the right provider for your content type. Use Video plugin for self-hosted videos, Embed plugin for third-party content.
Embeds load external content which can affect page performance. Consider lazy loading for content-heavy pages.
Some embeds may not load due to privacy settings or content restrictions. Consider providing fallback content or links.
Some platforms have embedding restrictions. Check provider policies for commercial use.
Configure appropriate maxWidth for your design to maintain consistency across embed types.

Troubleshooting

If a URL is not being detected, check:
  1. The URL format matches supported patterns
  2. The URL is from a supported provider
Solution: Use the parseEmbedUrl utility to debug:
Some content may be blocked due to:
  1. Content is private or restricted
  2. Platform blocks embedding from your domain
  3. CORS restrictions
Solution: Check the provider’s embedding policies and ensure content is publicly embeddable.
If the aspect ratio looks wrong:
  1. The provider may have changed their default dimensions
  2. The content may have a non-standard aspect ratio
Solution: Resize the embed manually using the resize handles.
Not all providers support oEmbed. The plugin will still work but may not have:
  1. Thumbnail images
  2. Title/description metadata
  3. Author information
Solution: This is expected behavior. The embed will still function correctly.

Embed vs Video Plugin

Recommendation: Use the Video plugin for self-hosted videos or when you need playback controls. Use the Embed plugin for third-party content from social media, code sandboxes, music services, and maps.