
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
react-iframe
Advanced tools
Simple React component for including an iframed page.
The component is fully typescript-supported.
import Iframe from 'react-iframe'
<Iframe url="https://www.sdrive.app/embed/1ptBQD"
width="640px"
height="320px"
id=""
className=""
display="block"
position="relative"/>
url (required) - string the iframe url.
all other attributes are optional
src - string if set, overrides url.
scrolling - string not set if if not provided (deprecated in HTML5).
overflow - string default to "hidden".
loading - string (not added to DOM if not provided).
frameBorder - number default to "0" (deprecated in HTML5).
position - string (not added to DOM if not provided).
id - string if set, adds the id parameter with the given value.
className - string if set, adds the class parameter with the given value.
display - string defaults to "block"
height - string (1px > any number above 0, or 1% to 100%)
width - string (1px > any number above 0, or 1% to 100%)
allowFullScreen - if set, applies the allowFullScreen param (deprecated in HTML5). If set, adds allow="fullscreen".
sandbox - add optional sandbox values. For single value, add as string. For multiple values, add as array ({"allow-scripts", "allow-same-origin"}). Valid values are "allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation"
allow - add optional allow values ("geolocation microphone camera midi encrypted-media & more")
styles - add any additional styles here. Will (intentionally) override any of the props above. For instance:
<Iframe url="http://www.youtube.com/embed/xDMP3i36naA"
position="absolute"
width="100%"
id="myId"
className="myClassname"
height="100%"
styles={{height: "25px"}}/>
will set the height to 25px even though it was specified as 100% in the props.
A comprehensive overview of the iframe element is available from the MDN web docs.
All source code resides in the src/
folder. The other code paths are generated by the tsc compiler.
This project provides a convenient TypeScript-enabled wrapper around the native HTML tag. You can achieve the same functionality with the native tag. You do not need to use TypeScript in your project to consume this library.
FAQs
Easy peasy lemon squeezy iframes with react
The npm package react-iframe receives a total of 74,164 weekly downloads. As such, react-iframe popularity was classified as popular.
We found that react-iframe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.