Responsive Dialog
Dialog on desktop, Drawer on mobile. Use this for almost every modal in the app. Reach for plain Dialog only for short confirmations that still look fine on a phone.
Default
Use the trigger slot for the opener, the default slot for the content. Open state is controlled with v-model:open.
With form
Form pattern inside ResponsiveDialog: padding handled with a wrapper div, action buttons at the end.
Prevent close
preventClose blocks overlay clicks and Escape. The close-prevented event lets you show a confirmation prompt.
Anatomy
Import all parts and piece them together.
vue
<script setup>
import {
ResponsiveDialog,
} from "@/components/ui/responsive-dialog";
</script>
<template>
<ResponsiveDialog>
<template #trigger />
<template #sticky-header />
<template #default />
<template #sticky-footer />
</ResponsiveDialog>
</template>API Reference
ResponsiveDialog
Accessibility
Keyboard shortcuts and ARIA behavior.
- Adapts to a Dialog on desktop and a Drawer on mobile, keeping the same accessibility contract.
- Focus is trapped within the content while open and restored to the trigger on close.
- Provide a title so screen readers can announce the dialog via aria-labelledby.