Skip to content

Repository files navigation

react-social-embeds

npm versionLicense: MIT

Unified React components for embedding social media and streaming content. One component per platform with consistent styling, theming, and TypeScript support.

▶️ Live Demo | 📦 npm | ⛓️‍💥 GitHub Repo

Installation

npm install react-social-embeds

Peer Dependencies

npm install react react-dom
# Optional - for HLS/DASH video streaming:
npm install hls.js dashjs
DependencyVersionRequired
react≥18Yes
react-dom≥18Yes
hls.js≥1.0No (for HLS streams)
dashjs≥4.0No (for DASH streams)

Quick Start

import{YouTubeEmbed,XEmbed,SpotifyEmbed}from"react-social-embeds";functionApp(){return(<div><YouTubeEmbedurl="https://www.youtube.com/watch?v=dQw4w9WgXcQ"/><XEmbedurl="https://x.com/elonmusk/status/123456789"theme="dark"/><SpotifyEmbedurl="https://open.spotify.com/track/4uLU6hMCjMI75M1A2tKUQC"/></div>);}

Supported Platforms

Social Media

ComponentPlatform
XEmbedX (Twitter)
InstagramEmbedInstagram
FacebookEmbedFacebook
ThreadsEmbedThreads
BlueskyEmbedBluesky
MastodonEmbedMastodon
TruthSocialEmbedTruth Social
LinkedInEmbedLinkedIn
RedditEmbedReddit
TumblrEmbedTumblr
PinterestEmbedPinterest
TelegramEmbedTelegram

Video

ComponentPlatform
YouTubeEmbedYouTube
TikTokEmbedTikTok
TwitchEmbedTwitch
KickEmbedKick
RumbleEmbedRumble
DailymotionEmbedDailymotion
OdyseeEmbedOdysee
BilibiliEmbedBilibili
ArchiveOrgEmbedArchive.org

Audio

ComponentPlatform
SpotifyEmbedSpotify
AppleMusicEmbedApple Music
ApplePodcastsEmbedApple Podcasts
SoundCloudEmbedSoundCloud
DeezerEmbedDeezer
TidalEmbedTidal

Common Props

All embed components share these common props:

interfaceCommonProps{url: string;// Required: Content URLtheme?: "light"|"dark";// Color theme (default: "light")width?: string|number;// Container widthmaxWidth?: string|number;// Maximum widthshowBranding?: boolean;// Show platform branding (default: true)showCTA?: boolean;// Show call-to-action button (default: true)ctaLabel?: string;// CTA button textdisableCard?: boolean;// Remove card stylinglinkBehavior?: "card"|"title"|"cta"|"none";linkTarget?: "_blank"|"_self";}

Core Components

EmbedCard

Base component used by all embeds. Use directly for custom embeds:

import{EmbedCard}from"react-social-embeds";<EmbedCardprovider="Custom"title="My Custom Embed"author="Author Name"body="Description text"href="https://example.com"theme="dark"media={{type: "image",url: "https://example.com/image.jpg"}}/>

MediaPlayer

Custom video player with HLS/DASH support:

import{MediaPlayer}from"react-social-embeds";<MediaPlayersrc="https://example.com/stream.m3u8"poster="https://example.com/poster.jpg"autoPlay={false}/>

Supports:

  • Native video (MP4, WebM)
  • HLS streams (.m3u8) via hls.js
  • DASH streams (.mpd) via dashjs

Theming

All components support light and dark themes:

<YouTubeEmbedurl={videoUrl}theme="dark"/>

Use CSS variables for custom styling:

.my-embed {
--embed-accent:#ff6b6b;
--embed-bg:#1a1a1a;
}

Layout Modes

Control layout with the CardLayoutProvider:

import{CardLayoutProvider,YouTubeEmbed}from"react-social-embeds";<CardLayoutProviderlayout="modern"><YouTubeEmbedurl={url}/></CardLayoutProvider>

Layouts: "classic" (metadata first) | "modern" (media first)

TypeScript

All components export their prop types:

import{YouTubeEmbed,YouTubeEmbedProps}from"react-social-embeds";import{EmbedCardProps,MediaPlayerProps}from"react-social-embeds";

License

MIT

About

React components for embedding social media and streaming content. Support for Reddit , X, Bluesky, Mastodon, Threads, Truth Social, Telegram, LinkedIn, Bilibili, Instagram, TikTok, Facebook, YouTube, Rumble, Dailymotion, Odysee, Archive.org, Kick, Twitch, Tumblr, Pinterest, Spotify, Apple Music, Deezer, Tidal, SoundCloud & Apple Podcasts

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages