@radix-ui/react-dialog

v1.1.15 MIT

View docs [here](https://radix-ui.com/primitives/docs/components/dialog).

Weekly Downloads
28.8M
Stars
18.7K
Forks
1.2K
Open Issues
787
Gzip Size
15.6 kB
Unpacked Size
101.5 kB
Last Updated
3mo ago

@radix-ui/react-dialog Download Trends

Download trends for @radix-ui/react-dialog029.9M59.9M89.8M119.8MFeb 2025MayAugNovFebApr 2026
@radix-ui/react-dialog

About @radix-ui/react-dialog

@radix-ui/react-dialog is a headless UI primitive that provides the foundational components and logic for building accessible modal dialogs in React applications.

It addresses the core challenge of creating interactive, trap-focus-enabled, and screen-reader-friendly dialogs without imposing any visual styling. This allows developers to fully control the look and feel of their dialogs while benefiting from Radix's extensive accessibility expertise and robust feature set.

The primitive exposes a set of composable React components such as `Root`, `Trigger`, `Portal`, `Overlay`, `Content`, `Close`, and `Title`, along with useful hooks. Developers interact with these components to manage the dialog's open/closed state, handle user interactions like closing on escape key press or outside clicks, and ensure proper focus management.

This package is designed to integrate seamlessly into any React project, particularly those using design systems or component libraries. Its unstyled nature makes it an ideal foundation for custom UI solutions and a powerful building block for more complex UI patterns within a React ecosystem.

With a bundle size of 15.6 kB (gzip), @radix-ui/react-dialog offers a performant solution for dialog implementation. The project is mature, as indicated by its frequent updates and extensive GitHub community, making it a reliable choice for production applications requiring accessible modal interfaces.

A potential consideration is the required effort in styling the dialog components from scratch. While this offers maximum design flexibility, it necessitates a clear styling strategy and implementation, which might be more involved than using a pre-styled component library.

When to use

  • When building custom, accessible modal dialogs that require full control over the visual presentation.
  • When integrating a dialog component into an existing design system without bringing in unwanted styles.
  • When leveraging the `useDialog` hook for programmatic control over dialog state and behavior.
  • When implementing keyboard accessibility features like trapping focus within the dialog and closing on `Escape` key press.
  • When needing to ensure screen reader compatibility through ARIA attributes managed automatically by the primitive.
  • When using the `Portal` component to render the dialog content outside the main DOM hierarchy for better layering and z-index management.

When NOT to use

  • If you only need a very basic, unstyled modal and can implement focus trapping and accessibility manually with minimal code.
  • If your project requires a fully pre-styled, out-of-the-box dialog component with minimal customization needs.
  • If you are working in an environment where introducing React component primitives that require manual styling is not aligned with project velocity.
  • If the project constraints mandate using a single, opinionated UI library that already provides its own dialog component.
  • If the overhead of composing and styling headless UI primitives outweighs the benefits of customizability for the specific use case.

@radix-ui/react-dialog Alternatives

@radix-ui/react-dialog Categories