Skip to Content
Overlays & Dialogs@hacline/ui/dialog

Dialog

A modal dialog built on @ui-sdk/react/dialog with multiple sizes and full-screen mode, placements, backdrop variants, sticky header/footer scrolling, responsive bottom sheets, and dismiss protection.

Imports

import {
  Dialog,
  DialogBackdrop,
  DialogBody,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/hacline/components/dialog";

Basic Usage

Compose DialogTrigger and DialogClose with render={<Button />} to get focus trapping, backdrop click dismissal, Escape key dismissal, and automatic focus restoration out of the box.

Sizes

Switch dialog width presets via the size prop on DialogContent, supporting sm, md (default), lg, xl, and full for full-screen mode.

Placement Variants

Adjust where the dialog sits within the viewport using placement, supporting center (default), top (near the top, suitable for search bars or dynamic-height content), and bottom (bottom-aligned card).

Backdrop Variants

Switch the background overlay style via the variant prop on DialogBackdrop: dim (default translucent dark), blur (frosted glass blur), or transparent (invisible backdrop).

Wrap long text or tall forms in DialogBody so DialogHeader and DialogFooter remain pinned while only the body area scrolls. Pair with initialFocus="content" to place initial keyboard focus directly at the top of the dialog content.

Bottom Sheet & Dismiss Protection

  • Set presentation="sheet" to render the dialog as a bottom sheet (or "auto" to automatically switch to a sheet on small touch devices while staying a dialog on large screens).
  • For high-risk confirmations, set dismissible={false} to prevent accidental dismissal via backdrop clicks, Escape, or swipe gestures (use onDismissAttempt to listen for blocked dismiss attempts).

Controlled Mode

Control dialog visibility externally with open and onOpenChange. When needed, call details.cancel() inside the callback to intercept dismissal.

Status: Closed

Props

Dialog

Prop

Type

DialogBackdrop

Prop

Type

DialogContent

Prop

Type

Data Attributes

AttributeDescription
data-slot="dialog-backdrop" / "dialog-content"Element identifiers for backdrop and content
data-open / data-closedDialog open or closed state
data-presentation="dialog" | "sheet"Actual active presentation mode
data-starting-style / data-ending-styleEntering first-frame and exiting transition markers