Modal
Dialog overlay. Two patterns: body-only, or with footer actions. Requires Alpine.js.
Two patterns
<div x-data="{ open1: false, open2: false }">
<div class="flex gap-3">
<button @click="open1 = true" class="btn btn-primary">Without footer</button>
<button @click="open2 = true" class="btn btn-secondary">With footer</button>
</div>
<template x-teleport="body">
<div x-show="open1" x-cloak>
<div class="modal-overlay" x-transition.opacity @click="open1 = false"></div>
<div class="modal-wrapper" x-transition>
<div class="modal" @click.outside="open1 = false">
<div class="modal-body">
<button @click="open1 = false" class="modal-close" aria-label="Close dialog">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-6 w-6"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" /></svg>
</button>
<h3 class="h3">Detail view</h3>
<p class="mt-2 text-sm text-secondary-500">This modal has no footer. Use for info dialogs or detail views.</p>
</div>
</div>
</div>
</div>
</template>
<template x-teleport="body">
<div x-show="open2" x-cloak>
<div class="modal-overlay" x-transition.opacity @click="open2 = false"></div>
<div class="modal-wrapper" x-transition>
<div class="modal" @click.outside="open2 = false">
<div class="modal-body">
<button @click="open2 = false" class="modal-close" aria-label="Close dialog">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-6 w-6"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" /></svg>
</button>
<h3 class="h3">Confirm action</h3>
<p class="mt-2 text-sm text-secondary-500">Are you sure? This cannot be undone.</p>
</div>
<div class="modal-footer">
<button @click="open2 = false" class="btn btn-secondary">Cancel</button>
<button @click="open2 = false" class="btn btn-danger">Delete</button>
</div>
</div>
</div>
</div>
</template>
</div>
Detail view
This modal has no footer. Use for info dialogs or detail views.
Confirm action
Are you sure? This cannot be undone.
Size variants
Use .modal-lg or .modal-xl for wider dialogs.
Large modal
Use for longer forms and content that needs more horizontal space.
Extra large modal
Use for wide workflows, previews, or comparison views.
<div class="space-y-3">
<div class="modal modal-lg">
<div class="modal-body">
<h3 class="h3">Large modal</h3>
<p class="mt-2 text-sm text-secondary-500">Use for longer forms and content that needs more horizontal space.</p>
</div>
</div>
<div class="modal modal-xl">
<div class="modal-body">
<h3 class="h3">Extra large modal</h3>
<p class="mt-2 text-sm text-secondary-500">Use for wide workflows, previews, or comparison views.</p>
</div>
</div>
</div>