react-motion-modal
react-motion-modal is a React modal management library built around a global modal store, type-safe modal parameters, and position-aware motion defaults.
What it gives you
- Open modals from anywhere with
modalStore() - Register modal components once with
ModalProvider - Type-safe params through
ModalDefinitionmodule augmentation - Built-in positions such as
right,bottom,top-left, andcenter-full - Default animations that follow modal placement
Installation
- npm
- Yarn
npm install react-motion-modal motion zustand
yarn add react-motion-modal motion zustand
warning
Peer Dependencies
react and react-dom are expected to already exist in your app.
Core flow
- Define your modal names and params through
ModalDefinition - Mount
ModalProvideronce near the root - Call
modalStore().openModal(...)from anywhere - Read
closeModalinside the modal component props
The next pages cover the actual API and integration details.