overlays
Display a modal within your application.
<script setup>
const isOpen = ref(false)
</script>
<template>
<div>
<UButton label="Open" @click="isOpen = true" />
<UModal v-model="isOpen">
<!-- Content -->
</UModal>
</div>
</template>
You can put a Card component inside your Modal to handle forms and take advantage of header
and footer
slots:
<script setup>
const isOpen = ref(false)
</script>
<template>
<div>
<UButton label="Open" @click="isOpen = true" />
<UModal v-model="isOpen">
<UCard :ui="{ divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
<template #header>
<!-- Content -->
</template>
<!-- Content -->
<template #footer>
<!-- Content -->
</template>
</UCard>
</UModal>
</div>
</template>
Prop | Default | Description |
---|---|---|
modelValue | false | boolean |
appear | false | boolean |
overlay | true | boolean |
transition | true | boolean |
ui | appConfig.ui.modal | any |
{
"wrapper": "relative z-50",
"inner": "fixed inset-0 overflow-y-auto",
"container": "flex min-h-full items-end sm:items-center justify-center text-center",
"padding": "p-4 sm:p-0",
"base": "relative text-left overflow-hidden sm:my-8 w-full flex flex-col",
"overlay": {
"base": "fixed inset-0 transition-opacity",
"background": "bg-gray-200/75 dark:bg-gray-800/75",
"transition": {
"enter": "ease-out duration-300",
"enterFrom": "opacity-0",
"enterTo": "opacity-100",
"leave": "ease-in duration-200",
"leaveFrom": "opacity-100",
"leaveTo": "opacity-0"
}
},
"background": "bg-white dark:bg-gray-900",
"ring": "",
"rounded": "rounded-lg",
"shadow": "shadow-xl",
"width": "sm:max-w-lg",
"height": "",
"transition": {
"enter": "ease-out duration-300",
"enterFrom": "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
"enterTo": "opacity-100 translate-y-0 sm:scale-100",
"leave": "ease-in duration-200",
"leaveFrom": "opacity-100 translate-y-0 sm:scale-100",
"leaveTo": "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
}
}