
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
`react-motion-modal` is a flexible modal management library built with [Zustand](https://zustand-demo.pmnd.rs/) for state management and powered by [Framer Motion](https://www.framer.com/motion/) for beautiful animations. It offers full TypeScript type-sa
react-motion-modal is a flexible modal management library built with Zustand for state management and powered by Framer Motion for beautiful animations. It offers full TypeScript type-safety and allows dynamic modal opening with custom parameters.
closeModal() into each modal propsnpm install react-motion-modal
or with yarn:
yarn add react-motion-modal zustand
Create a modal.d.ts file in your project (make sure to include it in tsconfig.json):
import type { ReactElement } from 'react';
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 { useModal } from 'react-motion-modal';
const { openModal } = useModal();
openModal('ConfirmModal', {1
title: 'Are you sure you want to delete?',
});
closeModal inside your modal componentconst ConfirmModal = ({ title, closeModal }: ModalDefinition<'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.BaseModalParamsEach modal automatically receives the following props:
| Prop | Type | Description |
|---|---|---|
closeModal | () => void | Close function for the modal |
closeOnClickOutside | boolean | Close modal when clicking outside |
closeOnPressEsc | boolean | Close modal when Escape key is pressed |
container | { className?: string; override?: boolean; } | Customize wrapper styles |
body | { className?: string; override?: boolean; } | Customize inner modal styles |
animate | { animate?: TargetAndTransition; exit?: TargetAndTransition; } | Animation powered by Framer Motion. Customize how the modal enters and exits. |
onClose | () => void | Callback triggered when modal is closed |
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 20 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.