Toggle Sidebar B
header.lightDarkMode D

Dialog

Modal overlay for confirmations, short forms, or extra detail. For modals that should turn into bottom drawers on mobile, use DialogResponsive instead.

Anatomy

Import all parts and piece them together.

vue
<script setup>
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog";
</script>

<template>
  <Dialog>
    <DialogTrigger />
    <DialogContent>
      <DialogHeader>
        <DialogTitle />
        <DialogDescription />
      </DialogHeader>
      <DialogFooter />
      <DialogClose />
    </DialogContent>
  </Dialog>
</template>

Default

Standard confirmation dialog. Trigger opens, Close dismisses.

With form

Common layout: header, body with Field and Input, footer with action buttons.

Controlled

Drive the open state externally via v-model:open. Use when the dialog is triggered by a non-button event.

API Reference

Props, events, and slots for each sub-component.

Dialog

Props

PropTypeDefaultDescription
openbooleanOpen state. Supports v-model:open.
modalbooleantrueWhether the dialog blocks outside interaction (focus trap and overlay click).

Events

EventDescription
update:openFires when the open state changes. Enables v-model:open.

DialogContent

Props

PropTypeDefaultDescription
classstringDefault width is sm:max-w-md. Override to go wider.

Events

EventDescription
escape-key-downFires when Escape is pressed. Call preventDefault to keep it open.
pointer-down-outsideFires on a pointer press outside the content.
interact-outsideFires on any outside interaction (pointer or focus).

DialogScrollContent

Props

PropTypeDefaultDescription
classstringVariant of DialogContent that scrolls the whole dialog (overlay + content) for very tall bodies.

Events

EventDescription
escape-key-downSame outside-interaction events as DialogContent.

DialogTrigger / DialogClose

Props

PropTypeDefaultDescription
asChildbooleanfalseRender the child slot without the default button wrapper.

Accessibility

Keyboard shortcuts and ARIA behavior.

Keyboard

ShortcutDescription
SpaceWhen focus is on the trigger, opens the dialog.
EnterWhen focus is on the trigger, opens the dialog.
TabMoves focus to the next focusable element inside the dialog.
Shift+TabMoves focus to the previous focusable element.
EscCloses the dialog and returns focus to the trigger.
  • Focus is trapped within the content while open and restored to the trigger on close.
  • Built on reka-ui Dialog: content is labelled by DialogTitle and described by DialogDescription via aria-labelledby / aria-describedby.
  • Always include a DialogTitle (visually hidden if needed) so screen readers announce the dialog.