React Easy Modals

Modals you can await.

A headless, zero-dependency modal stack for React. Open a modal like you call a function, and get its answer back.

Start with Getting started, or read the source on GitHub (opens in a new tab) and the package on npm (opens in a new tab).

project-settings.tsx

Run it: the modal opens, and the promise waits for its answer.

Get started

  1. Install. One package, no dependencies besides React.

  2. Add the provider. It renders the stack at the root of your app.

  3. Open a modal. Any component works. Its close value is the result.

Features

A modal stack

A new modal hides the one below it until it closes.

open modals: 0
How the stack works

Nested modals

Open a modal inside a modal, and close any level of the chain.

Nested modals

Close guards

Keep a modal open until the user is ready to leave.

useBeforeClose

Exit animations

Play the exit animation first, then unmount.

promises resolved after the animation: 0
Transitions

Lazy loading

Load a modal’s code only when it opens.

Lazy loading

shadcn/ui

Add a Modal built on your Dialog. The registry serves the Radix or Base UI version to match the style in your components.json.

settings-page.tsx
Read the registry guide

Docs