Skip to content

Modal

A dialog overlay for confirmations, forms, or detailed content. Renders via <Teleport to="body"> to avoid z-index issues.

Demo

Glass Modal

Large Glass Modal

Usage

vue
<script setup lang="ts">
import { ref } from 'vue'
import { LiquidModal, LiquidButton } from '@liquid/ui'

const isOpen = ref(false)
</script>

<template>
  <LiquidButton @click="isOpen = true">Open Modal</LiquidButton>

  <LiquidModal
    v-model="isOpen"
    title="Confirm Delete"
    size="md"
    :show-close="true"
  >
    <!-- Default slot: modal body content -->
    <p>Are you sure you want to delete this item?</p>

    <!-- Named slot: footer actions -->
    <template #footer>
      <LiquidButton variant="outline" @click="isOpen = false">Cancel</LiquidButton>
      <LiquidButton variant="danger" @click="handleDelete">Delete</LiquidButton>
    </template>
  </LiquidModal>
</template>

Props

PropTypeDefaultDescription
modelValuebooleanfalseControls visibility (use with v-model)
titlestring''Modal header title
size'sm' | 'md' | 'lg' | 'xl''md'Modal width
variant'default' | 'glass-css-only' | 'glass-highlight-layered''default'Visual style
showClosebooleantrueShow the × close button in the header

Events

EventPayloadDescription
update:modelValuebooleanEmitted when modal should close (overlay click or × button)

Slots

SlotDescription
defaultModal body content
footerFooter area (typically action buttons)

Notes

  • Modal uses <Teleport to="body">, so it always renders above all other content.
  • Clicking the overlay backdrop closes the modal by emitting update:modelValue with false.
  • In VitePress, wrap <LiquidModal> in <ClientOnly> to avoid SSR hydration issues with Teleport.

Built with Vue 3 + Liquid Glass