Skip to content

GkDialog

A dialog shell built on GkOverlay: v-model, scrim, Escape / scrim dismiss (unless persistent), body scroll lock, role="dialog" / aria-modal, and forwarded attributes for aria-labelledby / aria-describedby.

Unlike Vuetify’s VDialog, there is no activator slot, VDefaultsProvider, router back, location/scroll strategies, or global overlay stack — compose with a button and v-model (see demo).

When to use

Use for focused modal workflows that require acknowledgement or completion before users continue (confirmations, form steps, destructive actions).

Live demo

API

Props

PropTypeDefaultDescription
modelValuebooleanfalseOpen state; use v-model
fullscreenbooleanfalseEdge-to-edge surface (fills the overlay)
scrollablebooleanfalseScroll overflow inside the surface (max-height when not fullscreen)
persistentbooleanfalsePassed to GkOverlay — scrim and Escape do not close
tostring | HTMLElement'body'Teleport target (GkOverlay)
zIndexnumber | string--gk-dialog-z-indexStack order
showScrimbooleantruePassed to GkOverlay
restoreFocusbooleantruePassed to GkOverlay
widthstring | numberSurface width (numbers become px)
maxWidthstring | numberSurface max-width
heightstring | numberSurface height
maxHeightstring | numberSurface max-height

Additional attributes (for example aria-labelledby, aria-describedby) are forwarded to GkOverlay (panel element).

Slots

SlotDescription
defaultDialog body (inside the styled surface)

Events

EventPayloadDescription
update:modelValuebooleanOpen state
click:outsideMouseEventScrim clicked (GkOverlay); not emitted when persistent
afterEnterOverlay transition finished entering
afterLeaveOverlay transition finished leaving

Tokens

TokenPurpose
--gk-dialog-z-indexDefault stacking (2400)
--gk-dialog-max-widthMax width for the overlay content when not fullscreen
--gk-dialog-scroll-max-heightCap for scrollable body height
--gk-dialog-shadowPanel shadow (non-fullscreen)

Example

vue
<script setup lang="ts">
import { ref } from 'vue'
import { GkButton, GkDialog } from 'god-kit/vue'
</script>

<template>
  <GkButton type="button" @click="open = true">Open dialog</GkButton>
  <GkDialog
    v-model="open"
    aria-labelledby="dlg-title"
    scrollable
    @after-leave="onClosed"
  >
    <h2 id="dlg-title">Title</h2>
    <p>Content goes here.</p>
    <GkButton type="button" @click="open = false">Close</GkButton>
  </GkDialog>
</template>

Accessibility notes

  • Always provide aria-labelledby and point it to a visible heading inside the dialog.
  • Add aria-describedby when the dialog body includes guidance text users must hear before acting.
  • Keep at least one keyboard-focusable control inside the dialog body or actions region.

Out of scope (v1)

Activator slot, VDefaultsProvider, router integration, focus-trap package, and parity with Vuetify overlay location/scroll/lazy stacks.

Released under the MIT License.