On this page

Dialog

Install, props and the parts Dialog is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/dialog.json

Use

<script setup lang="ts">
import { Button } from '@/components/ui/button'
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
</script>

<template>
  <Dialog>
    <DialogTrigger as-child>
      <Button variant="outline">Edit connection</Button>
    </DialogTrigger>
    <DialogContent>
      <DialogHeader>
        <DialogTitle>Edit connection</DialogTitle>
        <DialogDescription>Changes apply from the next sync.</DialogDescription>
      </DialogHeader>
      <!-- fields -->
      <DialogFooter>
        <DialogClose as-child>
          <Button variant="outline">Cancel</Button>
        </DialogClose>
        <Button>Save changes</Button>
      </DialogFooter>
    </DialogContent>
  </Dialog>
</template>

Props

Part Prop Values Notes
Dialog open, defaultOpen boolean Controlled (v-model:open) or initial state
Dialog modal boolean true by default
DialogTrigger, DialogClose as-child boolean Use it, so they are your buttons
DialogContent showCloseButton boolean true by default: the close button in the corner
DialogContent closeLabel string Name of the close button. Close by default; translate it
DialogContent overlayClass class For the scrim, such as a higher layer when one dialog opens above another
DialogContent class Width: size.dialog.default (512 px) at most by default
DialogFooter showCloseButton boolean Adds a Close button before the slot
DialogFooter closeLabel string Its text. Close by default
DialogScrollContent closeLabel string Same as DialogContent, for a dialog that scrolls as a whole
DialogHeader, DialogTitle, DialogDescription, DialogOverlay Parts

Built on

Wraps the reka-ui Dialog with the shadcn-vue Dialog API, as control-center ships it. reka-ui gives the dialog role and name, focus trapping and return, Esc and outside-click closing, and scroll locking. Beehexa adds the styles, closeLabel, and puts the footer’s Close button first so a primary action stays last (D10).

Limitations

  • The scrim has no blur; there is no token for one.