Skip to content

Dialog

A popup that opens on top of the entire page.

API Reference

Installation

pnpm dlx shadcn@latest add @frontal-labs/dialog

Usage

import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog";
<Dialog>
  <DialogTrigger>Open Dialog</DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Dialog Title</DialogTitle>
      <DialogDescription>Dialog Description</DialogDescription>
    </DialogHeader>
    <div>Content</div>
    <DialogFooter>
      <DialogClose>Close</DialogClose>
    </DialogFooter>
  </DialogContent>
</Dialog>

API Reference

Dialog

Root component. Alias for Dialog.Root from Base UI.

DialogTrigger

Trigger button that opens the dialog. Alias for Dialog.Trigger from Base UI.

DialogContent

Popup container that displays the dialog content. Renders the portal and the overlay internally, so DialogPortal and DialogOverlay do not need to be composed by hand.

All other props from Dialog.Popup are supported.

The dark prop

The dialog renders with the dark palette by default. Pass dark={false} when it should follow the ambient theme instead — next-themes sets dark on <html> and the portal lands in document.body, inside it, so the surface can pick up the ambient theme once dark is turned off.

If the dialog is opened from a .dark region scoped mid-page, which a portal does escape, rendering into the scoped node keeps inheritance intact in both directions without needing this prop at all.

<DialogContent dark>...</DialogContent>

DialogHeader

Container for the dialog title and description.

DialogFooter

Footer section for action buttons. Renders with a top border and a muted background.

Example:

<DialogFooter>
  <DialogClose>Cancel</DialogClose>
  <Button>Save</Button>
</DialogFooter>
 
// With an appended close button
<DialogFooter showCloseButton />

DialogTitle

Title component. Alias for Dialog.Title from Base UI.

DialogDescription

Description component. Alias for Dialog.Description from Base UI.

DialogClose

Close button component. Alias for Dialog.Close from Base UI.

DialogPortal

Portal component for rendering outside the DOM hierarchy. Alias for Dialog.Portal from Base UI. Rendered internally by DialogContent.

DialogOverlay

Backdrop component. Styled wrapper for Dialog.Backdrop from Base UI. Rendered internally by DialogContent.

Examples

Open from a Menu

Dialog with a Form

Dialog with scroll inside

Nested Dialogs

Close Confirmation