Modals

VdModal renders a viewport-safe overlay dialog sized by the Fibonacci ladder and landscape Golden Ratio (1.618:1) by default. Drive it from a boolean with v-model:open, choose one of five size tiers (sm through 2xl), or add glass for a frosted panel. Tabbed bodies keep a steady height without jumping, and closing triggers an immediate smooth Fibonacci fade-out.

Modal Sizes
Glass Modal

Pass :glass="true" for a frosted panel and blurred backdrop (.vd-modal-glass). Open the live Glass Studio below and pull any slider while the modal is open — every --vd-glass-* token updates immediately in real time.

blur 16pxsaturate 2.05opacity 0.32border 0.36
Static Backdrop

Pass :close-on-backdrop="false" so a backdrop click does not dismiss a destructive confirmation.

CSS Variables
VariableDefaultDescription
--vd-modal-bgvar(--vd-color-white)Panel background
--vd-modal-backdrop-bgrgba(0,0,0,0.5)Backdrop overlay color
--vd-modal-border-colorvar(--vd-border-color)Panel border color
--vd-modal-padding1.3125rem (21px)Panel padding (Fibonacci)
--vd-modal-header-padding1.3125remHeader padding
--vd-modal-body-padding1.3125remBody padding
--vd-modal-footer-padding1.3125remFooter padding
--vd-modal-golden-ratio1.618034Default landscape proportion ratio
--vd-modal-max-heightmin(95dvh, calc(100dvh - 2*margin))Viewport-safe maximum height
--vd-modal-width-sm377pxSmall width (fib 14, golden 233px tall)
--vd-modal-width610pxDefault width (fib 15, golden 377px tall)
--vd-modal-width-lg987pxLarge width (fib 16, golden 610px tall)
--vd-modal-width-xl1280pxExtra-large wide workspace width
--vd-modal-width-2xlmin(95dvw, 95dvh × φ)95% viewport-bounded golden width
--vd-modal-enter-duration233ms (--vd-duration-233)Enter timing
--vd-modal-leave-duration144ms (--vd-duration-144)Smooth exit timing
--vd-modal-z-index1050Modal stacking
--vd-modal-backdrop-z-index1040Backdrop stacking
--vd-glass-blur16pxGlass modal blur (backdrop uses 55%)
--vd-glass-saturate2.05Glass backdrop-filter saturation
--vd-glass-bg-opacity0.42 (0.18 dark)Glass modal panel fill opacity
--vd-glass-border-alpha0.4 (0.34 dark)Glass modal panel border alpha
--vd-glass-shadow0 14px 40px …Glass panel box-shadow
API Reference

Usage

<script setup lang="ts">
import { ref } from "vue";
import { VdModal } from "@vanduo-oss/vd3";

const open = ref(false);
</script>

<template>
  <button class="vd-btn vd-btn-primary" @click="open = true">Open Modal</button>

  <VdModal v-model:open="open" title="Modal Title" size="md">
    <p class="vd-mb-0">Modal content goes here.</p>
    <template #footer>
      <button class="vd-btn vd-btn-outline" @click="open = false">
        Cancel
      </button>
      <button class="vd-btn vd-btn-primary" @click="open = false">Save</button>
    </template>
  </VdModal>
</template>

Props

PropDescription
openboolean (required) — controls visibility. Pair with v-model:open or handle @update:open.
titlestring — header title; also used as the dialog aria-label (falls back to "Dialog").
size"sm" | "md" | "lg" | "xl" | "2xl" — landscape Fibonacci width tier (default "md"; "2xl" fills 95% of viewport in golden ratio).
goldenboolean — maintain a 1.618:1 landscape Golden Ratio minimum proportion clamped to the viewport (default true).
stableHeightboolean — keep panel height steady when switching tabs so dialogs do not jump (default true).
closeOnBackdropboolean — whether a backdrop click closes the modal (default true).
glassboolean — frosted glass panel + backdrop (`.vd-modal-glass` / `.vd-modal-glass-backdrop`, default false).
animatedboolean — enable smooth Fibonacci scale & fade transition (233ms enter, 144ms fade-out; default true).
durationnumber — optional transition duration override in milliseconds.

Events

EventDescription
update:openEmitted with false when the modal requests to close (backdrop, Escape, or the close button). Enables v-model:open.
closeEmitted alongside update:open whenever the modal closes.

Slots

SlotDescription
headerOptional extra header content, rendered after the title.
defaultThe modal body content.
footerFooter action bar — rendered only when provided.

CSS Classes

ClassDescription
.vd-modalRoot overlay container (present only while the modal is open).
.vd-modal-openMarks the overlay as open — drives the visible state.
.vd-modal-backdropFull-screen backdrop; a click closes the modal unless close-on-backdrop is false.
.vd-modal-panelThe centered dialog panel holding the header, scrollable body, and pinned footer.
.vd-modal-panel-sm / -md / -lg / -xl / -2xlPanel width & golden ratio sizing matching the size prop.
.vd-modal-auto-heightOpt-out modifier added when :golden="false" (lets short modals shrink to content).
.vd-modal-dynamic-heightOpt-out modifier added when :stable-height="false" (lets tab switches resize height).
.vd-modal-glassRoot modifier for the frosted glass panel (set via the glass prop).
.vd-modal-glass-backdropBackdrop blur companion to `.vd-modal-glass` (set via the glass prop).
.vd-modal-headerHeader bar with the title and the auto-rendered close button.
.vd-modal-titleHeading element populated from the title prop.
.vd-modal-bodyScrollable body region (the default slot).
.vd-modal-footerPinned footer action bar (the footer slot).
Accessibility
  • The overlay is a role="dialog" with aria-modal="true"; its accessible name comes from the title prop (falling back to "Dialog").
  • On open, focus moves to the dialog panel so keyboard users start inside the modal.
  • Escape closes the modal (emitting update:open and close).
  • A backdrop click closes the modal unless :close-on-backdrop="false".
  • The auto-rendered close button carries aria-label="Close".