React modal libraries

Updated Nov 2026

React modal libraries render dialogs: windows that open over the page, hold keyboard focus, and close on Escape or a button. These libraries handle confirmations, forms, and settings panels that interrupt the page until a person responds.

Popularity

@radix-ui/react-dialog has the most monthly downloads in this comparison, at 365.3M.

LibraryMonthly downloadsStarsLast releaseLicense
@radix-ui/react-dialog
365.3M
19.5KOct 2026MIT
Base UI
109.8M
11.4KOct 2026MIT
Material UI
53.7M
99.3KOct 2026MIT
Headless UI
38.2M
28.8KApr 2026MIT
React Aria Components
33.2M
16.1KOct 2026Apache-2.0
Ant Design
19.9M
100.2KNov 2026MIT
Mantine
14.3M
32.0KNov 2026MIT
react-modal
14.1M
7.4KDec 2024MIT
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

@radix-ui/react-dialog

@radix-ui/react-dialog is the Dialog primitive from Radix: unstyled parts, Root, Trigger, Portal, Overlay, Content, Title, Description, and Close, that the app assembles and styles. In modal mode, focus stays inside the dialog, the content underneath becomes inert, and Escape closes it. Setting modal to false switches to non-modal mode. Title and Description give screen readers the dialog's name and summary.

Downloads / mo
365.3M
Stars
19.5K
Last release
1.3.1
License
MIT

Strengths

  • Modal and non-modal. Setting modal to false keeps the page behind the dialog interactive.
  • Controlled or uncontrolled. The dialog tracks its own open state or follows open and onOpenChange.

Limitations

  • Styles come from the app. Layout and appearance come from the app's CSS.
  • Custom triggers forward refs. A custom component used as a trigger accepts Radix's props, event handlers, and ref.

Quickstart

From dialog.md
$ npm install @radix-ui/react-dialog
import * as Dialog from "@radix-ui/react-dialog";

export default function Example() {
  return (
    <Dialog.Root>
      <Dialog.Trigger>Open dialog</Dialog.Trigger>
      <Dialog.Portal>
        <Dialog.Overlay />
        <Dialog.Content>
          <Dialog.Title>Notice</Dialog.Title>
          <Dialog.Description>Review this notice.</Dialog.Description>
          <Dialog.Close>Close</Dialog.Close>
        </Dialog.Content>
      </Dialog.Portal>
    </Dialog.Root>
  );
}

@radix-ui/react-dialog examples

From open-source projects on GitHub

Base UI is a library of unstyled React components from the MUI team, and its Dialog is a popup that opens over the whole page. Parts such as Dialog.Root, Dialog.Trigger, Dialog.Backdrop, Dialog.Popup, and Dialog.Close take class names or styles from the app. The modal prop chooses full modal behavior, no modality, or trap-focus, which keeps focus inside the dialog while the page still scrolls and takes clicks.

Downloads / mo
109.8M
Stars
11.4K
Last release
1.9.0
License
MIT

Strengths

  • Supports partial modal behavior. Use trap-focus to contain focus while allowing outside pointer interactions.
  • Supports detached dialog triggers. Associate triggers with a dialog through a shared handle.

Limitations

  • Close control for touch. In trap-focus mode, a close button inside the dialog lets touch screen reader users leave it.
  • Styles come from the app. Every dialog part is styled by the app.

Quickstart

From dialog.md
$ pnpm add @base-ui/react
import { Dialog } from '@base-ui/react/dialog';

export default function Example() {
  return (
    <Dialog.Root>
      <Dialog.Trigger>Open</Dialog.Trigger>
      <Dialog.Portal>
        <Dialog.Popup>
          <Dialog.Title>Example dialog</Dialog.Title>
          <Dialog.Close>Close</Dialog.Close>
        </Dialog.Popup>
      </Dialog.Portal>
    </Dialog.Root>
  );
}

Base UI examples

From open-source projects on GitHub

Material UI

Material UI is a React component library that implements Google's Material Design, and its Dialog renders a modal window in front of the app with Material styling. DialogTitle, DialogContent, DialogContentText, and DialogActions lay out the title, body, and buttons. The fullScreen prop fills the screen, and slots.transition swaps the default transition for one such as Slide. Dialogs follow the app's MUI theme.

Downloads / mo
53.7M
Stars
99.3K
Last release
9.5.0
License
MIT

Strengths

  • Material styling included. Dialogs come styled to Material Design and follow the app's theme.
  • Full screen on small screens. fullScreen combined with useMediaQuery fills the screen below a breakpoint.

Limitations

  • Installs a full UI library. The dialog comes from @mui/material, which installs with Emotion for styling.

Quickstart

From react-dialog.md
$ npm install @mui/material @emotion/react @emotion/styled
import { Dialog, DialogTitle, DialogContent } from '@mui/material';

export default function Example() {
  return (
    <Dialog open>
      <DialogTitle>Notice</DialogTitle>
      <DialogContent>Review this notice.</DialogContent>
    </Dialog>
  );
}

Headless UI is a set of unstyled, accessible React components from Tailwind Labs, the company behind Tailwind CSS. Its Dialog is controlled by open and onClose, and DialogPanel, DialogTitle, and Description mark the panel, title, and description. Focus stays inside the open dialog, the dialog renders into a portal, and Escape or a click outside the panel calls onClose.

Downloads / mo
38.2M
Stars
28.8K
Last release
2.2.10
License
MIT

Strengths

  • Contains keyboard focus. Tab navigation stays inside the open dialog.
  • Portals dialogs automatically. Dialog renders into a dedicated portal outside the application root.

Limitations

  • The app holds open state. The dialog opens and closes only through the open prop, which the app updates in onClose.
  • Styles come from the app. Layout and appearance come from class names, styles, or child elements.
  • Modal only. Focus always stays inside the open dialog, with no non-modal mode.

Quickstart

From dialog.md
$ npm install @headlessui/react
import { Description, Dialog, DialogPanel, DialogTitle } from '@headlessui/react'
import { useState } from 'react'

function Example() {
  let [isOpen, setIsOpen] = useState(false)

  return (
    <>
      <button onClick={() => setIsOpen(true)}>Open dialog</button>
      <Dialog open={isOpen} onClose={() => setIsOpen(false)} className="relative z-50">
        <div className="fixed inset-0 flex w-screen items-center justify-center p-4">
          <DialogPanel className="max-w-lg space-y-4 border bg-white p-12">
            <DialogTitle className="font-bold">Deactivate account</DialogTitle>
            <Description>This will permanently deactivate your account</Description>
            <p>Are you sure you want to deactivate your account? All of your data will be permanently removed.</p>
            <div className="flex gap-4">
              <button onClick={() => setIsOpen(false)}>Cancel</button>
              <button onClick={() => setIsOpen(false)}>Deactivate</button>
            </div>
          </DialogPanel>
        </div>
      </Dialog>
    </>
  )
}

Headless UI examples

From open-source projects on GitHub

React Aria Components

React Aria Components is Adobe's library of accessible, unstyled React components. A modal is built from three of them: ModalOverlay for the backdrop, Modal for the container, and Dialog for the labeled content, usually opened by a DialogTrigger around a button. Render props such as isEntering and isExiting style enter and exit animations. A click outside closes the modal only when isDismissable is set.

Downloads / mo
33.2M
Stars
16.1K
Last release
1.22.1
License
Apache-2.0

Strengths

  • Supports animated overlay states. Use isEntering and isExiting states to style modal transitions.
  • Separates overlay and content composition. Compose ModalOverlay, Modal, and Dialog for the modal structure.

Limitations

  • Needs a labeled Dialog. A Dialog with a heading in its title slot gives screen readers the modal's name.
  • Outside clicks opt in. isDismissable turns on closing the modal with a click outside it.
  • Modal only. The overlay always blocks interaction outside it, with no switch to turn that off.

Quickstart

From Modal.md
$ npm install react-aria-components
import { Modal, Dialog, Heading } from 'react-aria-components';

export default function Example() {
  return (
    <Modal isOpen>
      <Dialog>
        <Heading slot="title">Notice</Heading>
        <p>Review this notice.</p>
      </Dialog>
    </Modal>
  );
}

React Aria Components examples

From open-source projects on GitHub

Ant Design

Ant Design is a React component library for enterprise apps, and its Modal renders a styled dialog with a title, a body, and OK and Cancel buttons, controlled by open, onOk, and onCancel. Static methods such as Modal.confirm open a confirmation dialog from a function call, and Modal.useModal() does the same while reading theme and locale settings from the app. confirmLoading shows a loading state on the OK button while an action runs.

Downloads / mo
19.9M
Stars
100.2K
Last release
6.7.1
License
MIT

Strengths

  • OK and Cancel built in. The footer comes with OK and Cancel buttons wired to onOk and onCancel.
  • Confirmation from a call. Modal.confirm opens a confirmation dialog without rendering a component.

Limitations

  • Static methods skip context. Modal.confirm can't read ConfigProvider settings; Modal.useModal() and its contextHolder can.

Quickstart

From modal.md
$ npm install antd --save
import { Modal } from 'antd';

export default function Example() {
  return (
    <Modal open title="Notice">
      <p>Review this notice.</p>
    </Modal>
  );
}

Mantine is a React component library, and its Modal renders a styled dialog controlled by opened and onClose, often paired with the useDisclosure hook from @mantine/hooks. Props set the title, size, vertical centering, and transition. The fullScreen prop fills the screen, and combined with the media query hook it applies on small screens only. Focus trapping is on by default and turns off with trapFocus.

Downloads / mo
14.3M
Stars
32.0K
Last release
9.8.1
License
MIT

Strengths

  • Themed styling. The modal follows the Mantine theme the app already uses.
  • Full screen option. fullScreen fills the screen, and a media query can limit it to small screens.

Limitations

  • Provider setup first. The app wraps itself in MantineProvider and imports Mantine's styles before the modal renders.

Quickstart

From Demo.tsx
$ yarn add @mantine/core @mantine/hooks
import { useDisclosure } from '@mantine/hooks';
import { Modal, Button } from '@mantine/core';

function Demo() {
  const [opened, { open, close }] = useDisclosure(false);

  return (
    <>
      <Modal opened={opened} onClose={close} title="Authentication">
        {/* Modal content */}
      </Modal>

      <Button variant="default" onClick={open}>
        Open modal
      </Button>
    </>
  );
}

Mantine examples

From open-source projects on GitHub

react-modal is a standalone, accessible modal component for React. ReactModal opens when isOpen is true, takes a contentLabel for screen readers, and calls onRequestClose on Escape or a click on the overlay. ReactModal.setAppElement names the app's root element so it is hidden from screen readers while the modal is open. The content and overlay come with basic inline styles, which the style prop or class names replace.

Downloads / mo
14.1M
Stars
7.4K
Last release
3.16.3
License
MIT

Strengths

  • Restores prior focus automatically. Closing the modal returns focus to the previously focused element.
  • Supports Escape-key dismissal. Users can close the modal with Escape unless this behavior is disabled.

Limitations

  • App element set first. ReactModal.setAppElement points at the app's root so background content gets aria-hidden.
  • Classes replace default styles. A custom content or overlay class drops the default inline styles. The class then supplies every style.
  • Focus always contained. Tab always cycles inside the open modal, with no prop to turn that off.

Quickstart

From README.md
$ npm install react-modal
import ReactModal from 'react-modal';

ReactModal.setAppElement('#root');

export default function Example() {
  return (
    <ReactModal isOpen contentLabel="Notice">
      <p>Review this notice.</p>
    </ReactModal>
  );
}

react-modal examples

From open-source projects on GitHub

FAQ

In an app that already uses Material UI, Ant Design, or Mantine, use that library's dialog. For a custom design, use an unstyled primitive: Radix Dialog or Base UI for modal and non-modal dialogs, Headless UI alongside Tailwind CSS, or React Aria Components for animated overlays.

The shadcn/ui Dialog wraps Radix Dialog and adds Tailwind CSS styles. A second shadcn/ui base builds the same component on Base UI.

Render Dialog with an open prop and an onClose handler from Material UI, and place DialogTitle, DialogContent, and DialogActions inside it. The fullScreen prop fills the screen, for example below a breakpoint read with useMediaQuery.

Call Modal.confirm from Ant Design to open a confirmation dialog without rendering a component. To read theme and locale settings from ConfigProvider, use the modal instance from Modal.useModal() and render its contextHolder.

Yes. Setting modal to false on Radix Dialog turns off focus trapping and lets the page behind the dialog take clicks. Base UI also has a trap-focus mode that keeps focus inside without blocking the page.

Both are unstyled. Radix splits the dialog into parts such as Trigger, Overlay, and Content, and offers a non-modal mode. Headless UI is controlled through open and onClose, always keeps focus inside the dialog, and renders it in a portal.

For coding agents

Found your modal library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official