All Projects → tableflip → react-responsive-embed

tableflip / react-responsive-embed

Licence: MIT license
⚛️ Embed iframes responsively

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-responsive-embed

mastofeed
ActivityPub feed => iframe embed. https://www.mastofeed.com
Stars: ✭ 55 (+41.03%)
Mutual labels:  embed, iframe
Preact Habitat
Zero configuration Preact widgets renderer in any host DOM
Stars: ✭ 444 (+1038.46%)
Mutual labels:  embed, iframe
Sdk
Make any URL embeddable. Turn any URL into a beautiful link preview.
Stars: ✭ 446 (+1043.59%)
Mutual labels:  embed, iframe
postcss-aspect-ratio
A PostCSS plugin to fix an element's dimensions to an aspect ratio.
Stars: ✭ 38 (-2.56%)
Mutual labels:  aspect-ratio
get-css-data
A micro-library for collecting stylesheet data from link and style nodes
Stars: ✭ 29 (-25.64%)
Mutual labels:  iframe
embd-go
embd-go is an embeddable command-line tool for embedding data files in Go source code, specially crafted for easy use with `go generate`.
Stars: ✭ 24 (-38.46%)
Mutual labels:  embed
laravel-embed
Effortless responsive embeds for videos, slideshows and more.
Stars: ✭ 106 (+171.79%)
Mutual labels:  embed
mpv-scripts
dynamic-crop.lua script for mpv player/lib.
Stars: ✭ 43 (+10.26%)
Mutual labels:  aspect-ratio
node.lua
Platform for Internet of Things with Lua, Modern IoT device embedded software development platform.
Stars: ✭ 17 (-56.41%)
Mutual labels:  embed
cdn
🚀 ✈️ 🚄 free CDN for everyone who wants to speed his website freely!😄
Stars: ✭ 16 (-58.97%)
Mutual labels:  iframe
scion-microfrontend-platform
SCION Microfrontend Platform is a TypeScript-based open-source library that helps to implement a microfrontend architecture using iframes.
Stars: ✭ 51 (+30.77%)
Mutual labels:  iframe
post-messenger
👶 ~1 Kb wrapper of window.postMessage for cross-document communication.
Stars: ✭ 28 (-28.21%)
Mutual labels:  iframe
chrome-extension-aspectratio219
🖥️ Fit the screen properly in fullscreen mode on monitor ultrawide with 21:9 aspect ratio (Netflix, Youtube, PrimeVideo, Crunchyroll)
Stars: ✭ 28 (-28.21%)
Mutual labels:  aspect-ratio
Greedo Layout For Android
Full aspect ratio grid LayoutManager for Android's RecyclerView
Stars: ✭ 1,588 (+3971.79%)
Mutual labels:  aspect-ratio
calculate-aspect-ratio
📐 A simple utility function, and command line utility, for calculating an aspect ratio based on width and height.
Stars: ✭ 43 (+10.26%)
Mutual labels:  aspect-ratio
react-aspect-ratio
Preserve space for your element to prevent browser reflow (layout shift)
Stars: ✭ 94 (+141.03%)
Mutual labels:  aspect-ratio
haxe-c-bridge
Easily interact with haxe classes from C with an automatically generated C header
Stars: ✭ 46 (+17.95%)
Mutual labels:  embed
vue-rss-feed
Embed RSS Feeds in your Vue web app
Stars: ✭ 37 (-5.13%)
Mutual labels:  embed
MementoEmbed
A service that provides archive-aware oEmbed-compatible embeddable surrogates (social cards, thumbnails, etc.) for archived web pages (mementos).
Stars: ✭ 13 (-66.67%)
Mutual labels:  embed
trainmanjs
TrainmanJS - Cross-Origin Communication Library
Stars: ✭ 16 (-58.97%)
Mutual labels:  iframe

React ResponsiveEmbed

You want to embed a YouTube or other iframe style embedded content, and you'd like it to take up the available width, and retain it's aspect ratio.

Much like the Bootstrap responsive embed helpers of old, but for react.

Usage

npm install --save react-responsive-embed

Then in your app import ResponsiveEmbed and in JSX flavour you might do:

<ResponsiveEmbed src='https://www.youtube.com/embed/2yqz9zgoC-U' allowFullScreen />

Which'd give you an iframe element pointing at the src and any other props. It's wrapped in a div with just the right amount of padding-bottom to preserve a 16:9 aspect ratio like so:

<div style="position:relative;height:0;overflow:hidden;max-width:100%;padding-bottom:56.25%;">
  <iframe src="https://www.youtube.com/embed/2yqz9zgoC-U"  
    style="position:absolute;top:0;left:0;width:100%;height:100%;"
    frameborder="0"
    allowfullscreen></iframe>
</div>

Pass in a ratio prop to pick a different one. Any ratio will do:

<ResponsiveEmbed src='https://www.youtube.com/embed/2yqz9zgoC-U' ratio='4:3' />

frameborder="0" is applied by default.

Browserify / Webpack / Other?

This module is just a function. It's been babelified so it'll work with whatever your set up is. Use browserify or webpack or any other npm module consuming bundle whizzbang; ResponsiveEmbed don't mind.


A (╯°□°)╯︵TABLEFLIP side project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].