Edit an object
Keep a longer form in a scrolling body with stationary title and actions.
Components / Overlays
A native top-layer modal with a stationary header and footer and a scrollable body.
Last changed in version 0.13.4: Keep dialogs compact when a stylesheet resets their height.
bunx --bun @getweini/cli@latest add dialogImport the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.
<script setup lang="ts">
import Dialog from './components/ui/dialog/Dialog.vue'
import DialogBody from './components/ui/dialog/DialogBody.vue'
import DialogClose from './components/ui/dialog/DialogClose.vue'
import DialogContent from './components/ui/dialog/DialogContent.vue'
import DialogFooter from './components/ui/dialog/DialogFooter.vue'
import DialogHeader from './components/ui/dialog/DialogHeader.vue'
import DialogTitle from './components/ui/dialog/DialogTitle.vue'
import DialogTrigger from './components/ui/dialog/DialogTrigger.vue'
</script>
<template>
<Dialog>
<DialogTrigger>Open settings</DialogTrigger>
<DialogContent>
<DialogHeader><DialogTitle>Settings</DialogTitle></DialogHeader>
<DialogBody><p>Put your settings here.</p></DialogBody>
<DialogFooter><DialogClose>Done</DialogClose></DialogFooter>
</DialogContent>
</Dialog>
</template>Use DialogHeader’s #actions slot for an optional close control. Set persistent on DialogContent when backdrop clicks should leave the form open; Escape and close buttons still dismiss it. Fullscreen keeps the header and footer visible while DialogBody scrolls.
Keep a longer form in a scrolling body with stationary title and actions.
Open a modal view when the user needs to focus on one record.
The native dialog manages modality and restores trigger focus.
<script setup lang="ts">
import Dialog from './components/ui/dialog/Dialog.vue'
import DialogBody from './components/ui/dialog/DialogBody.vue'
import DialogClose from './components/ui/dialog/DialogClose.vue'
import DialogContent from './components/ui/dialog/DialogContent.vue'
import DialogDescription from './components/ui/dialog/DialogDescription.vue'
import DialogFooter from './components/ui/dialog/DialogFooter.vue'
import DialogHeader from './components/ui/dialog/DialogHeader.vue'
import DialogTitle from './components/ui/dialog/DialogTitle.vue'
import DialogTrigger from './components/ui/dialog/DialogTrigger.vue'
</script>
<template>
<Dialog>
<DialogTrigger>Edit profile</DialogTrigger>
<DialogContent size="lg">
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>Update your public details.</DialogDescription>
</DialogHeader>
<DialogBody>
<label>Name <input name="name"></label>
</DialogBody>
<DialogFooter><DialogClose>Done</DialogClose></DialogFooter>
</DialogContent>
</Dialog>
</template>Persistent content stays open on backdrop clicks but still responds to Escape.
<script setup lang="ts">
import Dialog from './components/ui/dialog/Dialog.vue'
import DialogBody from './components/ui/dialog/DialogBody.vue'
import DialogClose from './components/ui/dialog/DialogClose.vue'
import DialogContent from './components/ui/dialog/DialogContent.vue'
import DialogFooter from './components/ui/dialog/DialogFooter.vue'
import DialogHeader from './components/ui/dialog/DialogHeader.vue'
import DialogTitle from './components/ui/dialog/DialogTitle.vue'
import DialogTrigger from './components/ui/dialog/DialogTrigger.vue'
</script>
<template>
<Dialog>
<DialogTrigger>Review changes</DialogTrigger>
<DialogContent persistent>
<DialogHeader><DialogTitle>Review changes</DialogTitle></DialogHeader>
<DialogBody><p>Check these changes before you continue.</p></DialogBody>
<DialogFooter><DialogClose>Close review</DialogClose></DialogFooter>
</DialogContent>
</Dialog>
</template>Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.
| Name | Type or signature | Default | What it does |
|---|---|---|---|
openmodel | boolean | undefined | Not set | Current open state. Use v-model:open to keep it in sync with your page. |
defaultOpenprop | boolean | undefined | false | Starting open state when the parent does not control open. |
disabledprop | boolean | undefined | false | Prevent interaction and show the disabled state. |
update:openevent | [open: boolean] | — | Requests a new open value from the parent. |
openChangeevent | [open: boolean] | — | Emitted after this value or state changes. |
defaultslot | () => unknown | Required | Content shown inside Dialog. |
openexposed | () => void | — | Open this component from application code. |
closeexposed | () => void | — | Close this component from application code. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | {} | Optional | Content shown inside DialogBody. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
asChildprop | boolean | undefined | Not set | Use one child element as the control instead of adding another wrapper. |
defaultslot | {} | Optional | Content shown inside DialogClose. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
fullscreenprop | boolean | undefined | false | Fill the available viewport with the dialog content. |
sizeprop | DialogSize | undefined | "md" | Choose the visual size. Medium is the usual default where available. |
dismissOnBackdropprop | boolean | undefined | true | Allow a click outside the dialog content to close it. |
persistentprop | boolean | undefined | false | Keep the dialog open when the backdrop is clicked. |
defaultslot | { close: () => void; } | Optional | Content shown inside DialogContent. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | {} | Optional | Content shown inside DialogDescription. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | {} | Optional | Content shown inside DialogFooter. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | () => unknown | Required | Content shown inside DialogHeader. |
actionsslot | (() => unknown) | undefined | Optional | Content for the actions area of DialogHeader. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | {} | Optional | Content shown inside DialogTitle. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
disabledprop | boolean | undefined | false | Prevent interaction and show the disabled state. |
asChildprop | boolean | undefined | Not set | Use one child element as the control instead of adding another wrapper. |
defaultslot | {} | Optional | Content shown inside DialogTrigger. |
// packages/frameworks/vue/components/dialog/types.ts
// ------- TYPES -------
export type DialogSize = 'sm' | 'md' | 'lg' | 'xl'
export interface DialogProps {
open?: boolean
defaultOpen?: boolean
disabled?: boolean
}
export interface DialogContentProps {
fullscreen?: boolean
size?: DialogSize
dismissOnBackdrop?: boolean
persistent?: boolean
}
export interface DialogTriggerProps {
disabled?: boolean
asChild?: boolean
}
export interface DialogCloseProps {
asChild?: boolean
}