Skip to content

OverlayModal ​

A dialog on the native dialog element (showModal, closedby, requestClose, returnValue), with a script fallback for browsers that lack it. The open state can live in the URL.

ts
import { OverlayModal } from '@zairakai/vue-components/Overlay'

Usage ​

vue
<OverlayModal />

Example ​

vue
<script setup>
  import { ref } from 'vue'

  const open = ref(false)
</script>

<template>
  <button
    type="button"
    @click="open = true"
  >
    Open the dialog
  </button>
  <OverlayModal
    v-model="open"
    title="A native dialog"
    closedby="any"
  >
    It uses the dialog element: Escape and a click outside close it.
    <template #footer>
      <button
        type="button"
        @click="open = false"
      >
        Close
      </button>
    </template>
  </OverlayModal>
</template>

Props ​

NameTypeDefaultDescription
idstring
classstring
modelValuebooleanundefinedWhether the dialog is open. Use it with v-model, it works without too.
queryParamstringKeep the open state in this query parameter of the URL (?dialog=1).
titlestring
modalbooleantrueA modal blocks the page behind it; a non-modal dialog does not.
closedbystring'closerequest'How it can be dismissed: "any" (Escape and a click outside), "closerequest" (Escape), "none" (only the code).
alertbooleanfalseAn alert dialog interrupts the user and expects an answer.
closeButtonbooleantrue
closeLabelstring'Close'

Events ​

NameDescription
update:modelValue
open
close
cancel

Slots ​

NameDescription
header
close
default
footer

See Theming for the class hooks and the data-* state of the components.

Documentation of 1.4.4 , built from 8e9b054 on 1.4.4 by pipeline #2989941079 on 2026-10-26.