Skip to content

Dialog ​

Modal window for a short, blocking decision or a small form. Use drawer to keep list context and a full page for long tasks (layout-rules.md).

Usage ​

vue
<Dialog v-model:open="open">
  <DialogTrigger as-child><Button>Rename</Button></DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Rename project</DialogTitle>
      <DialogDescription>The URL does not change.</DialogDescription>
    </DialogHeader>
    <Input v-model="name" />
    <DialogFooter>
      <DialogClose as-child><Button variant="ghost">Cancel</Button></DialogClose>
      <Button variant="primary" @click="rename">Rename</Button>
    </DialogFooter>
  </DialogContent>
</Dialog>

Props ​

PartPropTypeDefaultNotes
Dialogopenbooleanfalsev-model:open
Dialogmodalbooleantrue
DialogContentsize'md' | 'sm' | 'lg''md'Max width 24, 32, 48 rem
DialogContentdismissiblebooleantruefalse blocks Escape and outside click
DialogContentshowClosebooleantrueCorner close button
DialogContentcloseLabelstring'Close'Accessible name of the close button
DialogTriggerasChildbooleanfalseMerge onto the child, such as a Button
DialogTriggerasAsTag | ComponentnoneElement to render; Reka renders a button
DialogCloseasChildbooleanfalseMerge onto the child, such as a Button
DialogCloseasAsTag | ComponentnoneElement to render; Reka renders a button
DialogTitleasChildbooleanfalseMerge onto the child
DialogTitleasAsTag | ComponentnoneElement to render; Reka renders an h2
DialogDescriptionasChildbooleanfalseMerge onto the child
DialogDescriptionasAsTag | ComponentnoneElement to render; Reka renders a p

DialogContent renders the portal and the overlay. Its class styles the dialog box; padding and gap sit on the scrolling body inside it. Dialog renders no element of its own, so it takes no class; every other part does. DialogHeader and DialogFooter take nothing else.

Slots ​

PartSlotContent
DialogdefaultThe trigger and the content
DialogTriggerdefaultThe control that opens the dialog
DialogContentdefaultHeader, body and footer
DialogHeaderdefaultTitle and description
DialogTitledefaultThe dialog's name
DialogDescriptiondefaultOne line under the title
DialogFooterdefaultActions, the primary one last
DialogClosedefaultThe control that closes the dialog

Events ​

PartEventPayloadWhen
Dialogupdate:openbooleanOpen state changes
DialogContentclosenoneAfter the close animation ends; not when the dialog is removed while open

Tokens ​

TokenFalls back toControls
--h-dialog-radius--h-radius-lgCorner radius

Surface is surface-raised; overlay is overlay; stacking is z-modal. Enter and exit animations (fade-* on the overlay, pop-* on the content) last --h-duration-normal, which is 0 ms under reduced motion.

States ​

closed, open; three sizes; with and without description; long content that scrolls inside the dialog; not dismissible; at 375 px (full-width with page margin).

Keyboard ​

KeyAction
EscapeClose, when dismissible
Tab, Shift+TabCycle focus inside the dialog

Accessibility ​

  • DialogTitle is required. A missing title fails the browser test.
  • Focus moves into the dialog on open and returns to the trigger on close. When the content scrolls, the dialog itself takes focus, so reading starts at the top.
  • Content behind the dialog is inert and does not scroll.
  • The close button's accessible name comes from the closeLabel prop on DialogContent, default Close.
  • Without a DialogDescription the content has no aria-describedby.

Do ​

vue
<DialogFooter>
  <DialogClose as-child><Button variant="ghost">Cancel</Button></DialogClose>
  <Button variant="danger" @click="remove">Delete project</Button>
</DialogFooter>

Do not ​

vue
<!-- A dialog opened from inside a dialog. Use one dialog with steps. -->
<DialogContent>
  <Dialog><DialogTrigger>More</DialogTrigger></Dialog>
</DialogContent>