Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Dialog

A window overlaid on the primary window, rendering content that requires the user's attention.

Installation

npx logic2b@latest add dialog

Usage

import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"

<Dialog>
  <DialogTrigger>Open</DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Are you absolutely sure?</DialogTitle>
      <DialogDescription>
        This action cannot be undone.
      </DialogDescription>
    </DialogHeader>
  </DialogContent>
</Dialog>

API

Prop Type Default
open boolean
onOpenChange (open: boolean) => void
defaultOpen boolean false
modal boolean — block interaction with the rest of the page true
showCloseButton (DialogContent) boolean true

Examples

Controlled

Drive the open state yourself to confirm a destructive action.

Accessibility

  • Built on Radix Dialog: focus is trapped inside the content and returns to the trigger on close.
  • DialogTitle is required for an accessible name — pair it with DialogDescription (wire both to the content via aria-labelledby / aria-describedby, which Radix handles automatically).
  • Escape and an overlay click both dismiss the dialog; the close button ships an sr-only “Close” label.