
Security News
Happy Birthday, Shai-Hulud
It has been one year since Shai-Hulud made its first appearance on npm.
react-motion-modal
Advanced tools
[](https://www.npmjs.com/package/react-motion-modal) [](https://www.npmjs.com/package/react-motion-modal) [ into each modal propsnpm install react-motion-modal motion zustand
or with yarn:
yarn add react-motion-modal motion zustand
react and react-dom are expected to already exist in your app.
Import the package stylesheet once in your app entry:
import 'react-motion-modal/style.css';
Create a modal.d.ts file in your project (make sure to include it in tsconfig.json):
import type { ModalDefinition } from 'react-motion-modal';
declare module 'react-motion-modal' {
interface ModalDefinition {
AlertModal: {
title: string;
};
ConfirmModal: {
onConfirm: () => void;
};
}
}
Import to define your modals
import { ModalProvider } from 'react-motion-modal';
export const App = () => {
return (
<div>
{/* rest of your app */}
<ModalProvider
modals={{
AlertModal,
ConfirmModal,
}}
/>
</div>
);
};
import { MODAL_POSITIONS, modalStore } from 'react-motion-modal';
const { openModal } = modalStore();
openModal('ConfirmModal', {
title: 'Are you sure you want to delete?',
position: MODAL_POSITIONS.RIGHT,
closeOnClickOutside: true,
});
closeModal inside your modal componentimport type { ModalParams } from 'react-motion-modal';
const ConfirmModal = ({ title, closeModal }: ModalParams<'ConfirmModal'>) => (
<div>
<h1>{title}</h1>
<button onClick={closeModal}>Close</button>
</div>
);
openModal(name, params)Opens a modal by name. The params will be inferred based on modal type.
closeModal(name?)name is provided, closes that specific modal.closeAllModal()Closes every modal from top to bottom and invokes each instance's onClose
callback once.
BaseModalParamsEach modal automatically receives the following props:
| Prop | Type | Description |
|---|---|---|
closeModal | () => void | Close function for the modal |
onClose | () => void | Callback triggered when modal is closed |
ariaLabel | string | Accessible dialog name. Defaults to Modal |
ariaLabelledBy | string | ID of the visible element that labels the dialog |
ariaDescribedBy | string | ID of the element that describes the dialog |
closeOnClickOutside | boolean | Close modal when clicking outside |
closeOnPressEsc | boolean | Close modal when Escape key is pressed |
position | string | Modal placement. Unknown values fall back to center. |
backdrop | { className?: string; style?: CSSProperties; } | Customize the backdrop layer |
body | { className?: string; style?: CSSProperties; } | Customize the modal body wrapper |
animate | { animate?: TargetAndTransition; exit?: TargetAndTransition; } | Animation powered by Framer Motion. Custom animation disables defaults. |
blur | boolean | Apply backdrop blur |
The package also exports Params, BaseModalParams, ModalConfig,
ModalInitialParams, and the store state/action types for advanced usage.
MODAL_POSITIONSMODAL_POSITIONS.TOP;
MODAL_POSITIONS.TOP_LEFT;
MODAL_POSITIONS.TOP_RIGHT;
MODAL_POSITIONS.TOP_CENTER;
MODAL_POSITIONS.LEFT;
MODAL_POSITIONS.RIGHT;
MODAL_POSITIONS.CENTER;
MODAL_POSITIONS.CENTER_FULL;
MODAL_POSITIONS.BOTTOM;
MODAL_POSITIONS.BOTTOM_LEFT;
MODAL_POSITIONS.BOTTOM_RIGHT;
MODAL_POSITIONS.BOTTOM_CENTER;
Default body animation follows the position. For example, left slides in from the left, right slides in from the right, top slides down, and bottom slides up.
.github/workflows/ci.yml on pushes and pull requests..github/workflows/publish.yml and uses npm trusted publishing with provenance.ModalRenderer to dynamically render modals from modals stateMade with ❤️ by react-motion-modal.
FAQs
Typed, awaitable modal flows for React, with headless Motion presets and deterministic orchestration.
The npm package react-motion-modal receives a total of 64 weekly downloads. As such, react-motion-modal popularity was classified as not popular.
We found that react-motion-modal 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.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.