react-motion-modal
react-motion-modal turns modal interactions into typed, awaitable flows. A
modal definition owns its input type, result type, motion preset, and
orchestration policy.
What it gives you
- Typed input and output inferred from the modal registry
await modals.open(...)instead of callback wiring- Explicit resolved and cancelled outcomes
- Isolated systems for SSR, tests, and multiple React roots
stack,replace, andsingletonorchestration- Headless
dialog,drawer, andsheetmotion presets - Focus trapping, focus restoration, scroll locking, and reduced motion
Installation
npm
Yarn
react and react-dom are peer dependencies and must already exist in the
application.
Core flow
- Create modal components with
ModalRenderProps<Input, Result>. - Register them with
defineModal()andcreateModalSystem(). - Mount
<ModalProvider system={modals} />. - Await
modals.open(name, input). - Call
resolve(value)orcancel()from the modal component.
