Skip to content
Eskais UI

Overlays

Dialog

UI SDK Dialog parts: focus trap, Escape, focus restore, dismissible and controller support.

Example

Installation

npx shadcn@latest add @eskais/dialog

Usage

Import
import {  Dialog,  DialogBackdrop,  DialogBody,  DialogClose,  DialogContent,  DialogDescription,  DialogFooter,  DialogHeader,  DialogTitle,  DialogTrigger,  backdropClassName,  contentClassName,  createDialogController,  dialogContentVariants,  useFocusReturn,} from "@/components/ui/dialog"import {  focusedElement,  mayReturnFocus,  useFocusAboveKeyboard,  useKeepPageStill,  useRecordFocusMove,  useRecordOpener,} from "@/components/ui/use-dialog-focus"import { useVisualViewportBox } from "@/components/ui/use-dialog-viewport"

API reference

DialogTrigger

Takes every prop of UI SDK DialogTrigger except aria-label, ButtonLookProps.

DialogContent

PropTypeDefault
size`sm` 24rem, `md` 32rem (default), `lg` 48rem, `xl` 72rem; `full` fills its container less `--floating-offset`.DialogSize"md"
sheetOn narrow screens it rises from the bottom as a full-width sheet; `false` keeps it centered.booleantrue

Also takes every prop of UI SDK DialogContent.

DialogHeader

Takes <div> attributes and render.

DialogBody

Takes <div> attributes and render.

DialogFooter

Takes <div> attributes and render.

DialogClose

Takes every prop of UI SDK DialogClose except aria-label, ButtonLookProps.

Other exports

DialogbackdropClassNamecontentClassNamecreateDialogControllerdialogContentVariantsuseFocusReturnfocusedElementmayReturnFocususeFocusAboveKeyboarduseKeepPageStilluseRecordFocusMoveuseRecordOpeneruseVisualViewportBoxtype DialogContentPropstype DialogSizetype FocusMemory

Accessibility

  • Focus moves in and is trapped; Escape closes; focus returns to the trigger.
  • Named by DialogTitle and described by DialogDescription.
  • Opaque reading surface in every theme, and a bottom sheet on narrow screens.

Agent actions

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.