
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.