Introducing PrimeReact v11-alpha ๐ŸŽ‰Discover Now
styledOverlay

Dialog

Dialog is a container to display content in an overlay window.

preview

Usage#

import { Dialog } from '@primereact/ui/dialog';
<Dialog.Root>
    <Dialog.Trigger />
    <Dialog.Portal>
        <Dialog.Backdrop />
        <Dialog.Positioner>
            <Dialog.Popup>
                <Dialog.Header>
                    <Dialog.Title />
                    <Dialog.HeaderActions>
                        <Dialog.Maximizable />
                        <Dialog.Close />
                    </Dialog.HeaderActions>
                </Dialog.Header>
                <Dialog.Content />
                <Dialog.Footer />
            </Dialog.Popup>
        </Dialog.Positioner>
    </Dialog.Portal>
</Dialog.Root>

Examples#

Basic#

A modal with a header, scrollable content, and footer actions.

basic-demo

Draggable#

A dialog can be repositioned by dragging its header when the draggable prop is enabled.

draggable-demo

Position#

The position of the dialog can be customized with the position property. The available values are top, top-left, top-right, bottom, bottom-left, bottom-right, left, right, and center.

position-demo

Maximizable#

A dialog can be maximized by clicking the Dialog.Maximizable button.

maximizable-demo

Full Screen#

The fullScreen prop opens the dialog in maximized mode. Without a Dialog.Maximizable button, the dialog remains full screen until closed.

fullscreen-demo

A modal dialog with a backdrop that blocks interaction with the page. When modal and dismissable are both enabled, clicking outside the dialog closes it.

modal-demo

Without Modal#

A dialog without a modal layer. The page remains interactive behind the dialog.

without-modal-demo

Confirmation#

A common pattern for confirmation dialogs with warning messages and action buttons.

confirmation-demo

Inside Scroll#

When scrollBehavior is set to inside, the dialog content area scrolls while the header and footer remain fixed.

inside-scroll-demo

Outside Scroll#

When scrollBehavior is set to outside, the entire dialog scrolls within the positioner, allowing the full dialog to move as a single unit.

outside-scroll-demo

Responsive#

Dialog width adapts to different screen sizes using responsive CSS classes on the Dialog.Popup.

responsive-demo

API#

Sub-Components#

See Primitive API for DialogRoot, DialogTrigger, DialogPortal, DialogBackdrop, DialogPositioner, DialogPopup, DialogHeader, DialogTitle, DialogHeaderActions, DialogMaximizable, DialogClose, DialogContent, DialogFooter component documentation.

Hooks#

See Headless API for useDialog hook documentation.

Accessibility#

See Dialog Primitive for WAI-ARIA compliance details and keyboard support.