Files
ui/docs/content/5.overlays/1.modal.md
Benjamin Canac 6da0db0113 feat: rewrite to use app config and rework docs (#143)
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Sébastien Chopin <seb@nuxt.com>
2023-05-04 14:49:19 +02:00

73 lines
1.1 KiB
Markdown

---
github: true
headlessui:
label: 'Dialog'
to: 'https://headlessui.com/vue/dialog'
---
## Usage
::component-example
#default
:modal-example-basic
#code
```vue
<script setup>
const open = ref(false)
</script>
<template>
<div>
<UButton label="Open" @click="open = true" />
<UModal v-model="open">
<!-- Content -->
</UModal>
</div>
</template>
```
::
You can put a [Card](/layout/card) component inside your Modal to handle forms and take advantage of `header` and `footer` slots:
::component-example
#default
:modal-example-card
#code
```vue
<script setup>
const open = ref(false)
</script>
<template>
<div>
<UButton label="Open" @click="open = true" />
<UModal v-model="open">
<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>
```
::
## Props
:component-props
## Preset
:component-preset