Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@koga73/react-overlay
Advanced tools
Readme
A React implementation of https://github.com/koga73/overlay
Overlay has been designed to be completely accessible. Features are as follows:
npm install @koga73/react-overlay
JSX
import ReactOverlay from "@koga73/react-overlay";
SCSS
@import "@koga73/react-overlay";
This component can be used in a controlled or uncontrolled manner - meaning the parent controls the Overlay open state (controlled) or not (uncontrolled)
Use the controlled implementation if you want your parent to maintain the visibility of the Overlay
import React, {useState} from "react";
import ReactOverlay from "@koga73/react-overlay";
//Be sure to import Overlay styles in here: @import "@koga73/react-overlay"
//Or customize, styles can be found here: https://github.com/koga73/overlay/tree/master/css
import "./example.scss";
() => {
const [stateIsOpen, setStateIsOpen] = useState(); //You can pass in an initial value here
return (
<div>
<div data-overlay-page-wrap>
<h1>Page content</h1>
<button onClick={evt => this.setStateIsOpen(true)}>Show Overlay</button>
</div>
<div style={{display: "none"}}>
<ReactOverlay
id="myOverlay"
isOpen={isOpen}
onRequestClose={detail => this.setStateIsOpen(false)}
>
<p>Some content</p>
</ReactOverlay>
</div>
</div>
);
};
Use the uncontrolled implementation if you don't care about maintaining the Overlay shown state
import React from "react";
import ReactOverlay from "@koga73/react-overlay";
//Be sure to import Overlay styles in here: @import "@koga73/react-overlay"
//Or customize, styles can be found here: https://github.com/koga73/overlay/tree/master/css
import "./example.scss";
class App extends React.Component {
render() {
return (
<div>
<div data-overlay-page-wrap>
<h1>Page content</h1>
<button onClick={evt => ReactOverlay.show("myOverlay")}>Show Overlay</button>
</div>
<div style={{display: "none"}}>
<ReactOverlay id="myOverlay">
<p>Some content</p>
</ReactOverlay>
</div>
</div>
);
}
}
The following props are parsed out and any other props get passed-through
The following callbacks are parsed out and any other callbacks get passed-through
By default a static instance is created on the window named ReactOverlay. You can override the default values below, just call update after. Note, ReactOverlay instances will use these defaults if not defined on the instance.
Note that if using React-DOM 18, you should specify the react root as the static container. This is because React-DOM 18 uses portals to render the Overlay outside of the root element.
import React from "react";
import ReactDOM from "react-dom/client";
import ReactOverlay from "@koga73/react-overlay";
const rootEl = document.getElementById("root");
ReactDOM.createRoot(rootEl).render(<Example />);
//Specify the root element as the container when using React-DOM 18
ReactOverlay.update({container: rootEl});
FAQs
A simple responsive modal system for the web. Fully accessible. Easy to style.
The npm package @koga73/react-overlay receives a total of 57 weekly downloads. As such, @koga73/react-overlay popularity was classified as not popular.
We found that @koga73/react-overlay demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.