Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
minimal-react-modal
Advanced tools
A minimalistic react modal component.
npm i minimal-react-modal
The bare minimal usage of this library is as follows:
import * as React from 'react';
import {ModalContainer, Modal} from 'minimal-react-modal';
React.render(
<ModalContainer>
{(openModal, closeModal, isActive) => (
<div>
<button onClick={openModal}>click me!</button>
<Modal
isActive={isActive} // required
closeModal={closeModal} // required
>
<h1>modal content</h1>
</Modal>
</div>
)}
</ModalContainer>
);
The area where you can call the open/close functions (openModal
/ closeModal
) and access the modal's state (isActive
).
propName | type | required | default | description |
---|---|---|---|---|
activeOnLoad | boolean | x | false | whether the modal should be active on load |
The modal component itself. You must pass the close function (closeModal
) and the modal status (isActive
) provided by the parent ModalContainer
component as props.
propName | type | required | default | description |
---|---|---|---|---|
isActive | boolean | o | - | (provided by ModalContainer ) |
closeModal | () => void | o | - | (provided by ModalContainer ) |
className | string | x | null | classname(s) to append to the modal box |
showCloseButton | boolean | x | false | whether to show the close button on the top right corner |
showAnimation | boolean | x | false | whether to animate modal opening |
modalBoxStyle | React.CSSProperties | x | {} | overrides modal styles |
closeButtonStyle | React.CSSProperties | x | {} | overrides default close button style (make sure showCloseButton is true ) |
overlayStyle | React.CSSProperties | x | {} | overrides modal background overlay style |
Here is another demo utilizing these optional props:
<ModalContainer>
{(openModal, closeModal, isActive) => (
<>
<button onClick={openModal}>click me!</button>
<Modal
isActive={isActive} // required
closeModal={closeModal} // required
className="demo"
showCloseButton={true}
showAnimation={true}
modalBoxStyle={{
width: 500,
height: 300,
padding: 30,
}}
>
<h1>modal content</h1>
</Modal>
</>
)}
</ModalContainer>
FAQs
a minimalistic react modal component
The npm package minimal-react-modal receives a total of 0 weekly downloads. As such, minimal-react-modal popularity was classified as not popular.
We found that minimal-react-modal 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.