Basic Modal

<x-ui.modal alpine-show="showModal">
    <x-slot:header>Modal Title</x-slot:header>
    <x-slot:body>Content</x-slot:body>
    <x-slot:footer>Footer</x-slot:footer>
</x-ui.modal>

Sizes

Livewire Integration

Use wire-model for Livewire integration:

// In Livewire component:
public $showModal = false;

// In Blade:
<x-button wire:click="$set('showModal', true)">Open</x-button>
<x-ui.modal wire-model="showModal">
    <x-slot:header>Title</x-slot:header>
    <x-slot:body>Content</x-slot:body>
</x-ui.modal>

Without Header/Footer

<x-ui.modal alpine-show="showSimple">
    <div class="p-4">Content</div>
</x-ui.modal>

Non-closeable Modal

Backdrop Effects

Overview

Modal component provides a flexible dialog overlay for displaying content, forms, or confirmations.

Sizes

Available sizes:

  • sm - max-w-md
  • default - max-w-2xl
  • lg - max-w-4xl
  • xl - max-w-6xl
  • 2xl - max-w-7xl
  • fullscreen - Full screen modal

Slots

Available slots:

  • header - Modal header (optional)
  • body - Modal body content (optional)
  • footer - Modal footer (optional)
  • default - Default slot (used when body is not provided)

Props

size - string (default: default)

Modal size: sm, default, lg, xl, 2xl, fullscreen

closeable - bool (default: true)

Show close button in header

closeOnBackdropClick - bool (default: true)

Close modal when clicking backdrop

closeOnEscape - bool (default: true)

Close modal when pressing ESC key

wire-model - string|null

Livewire property name for modal state

alpine-show - string|null

Alpine.js variable name for modal state

blur - bool (default: false)

Add backdrop blur effect to the modal overlay

darker - bool (default: false)

Make the backdrop darker (increased opacity)

Usage Examples

Alpine.js (default):

<x-button x-data="{ open: false }" @click="open = true">Open</x-button>
<x-ui.modal alpine-show="open">
    <x-slot:header>Title</x-slot:header>
    <x-slot:body>Content</x-slot:body>
</x-ui.modal>

Livewire:

<x-button wire:click="$set('showModal', true)">Open</x-button>
<x-ui.modal wire-model="showModal">
    <x-slot:header>Title</x-slot:header>
    <x-slot:body>Content</x-slot:body>
</x-ui.modal>

With blur effect:

<x-ui.modal alpine-show="showModal" blur>
    <x-slot:header>Title</x-slot:header>
    <x-slot:body>Content</x-slot:body>
</x-ui.modal>

With darker backdrop:

<x-ui.modal alpine-show="showModal" darker>
    <x-slot:header>Title</x-slot:header>
    <x-slot:body>Content</x-slot:body>
</x-ui.modal>

With both blur and darker backdrop:

<x-ui.modal alpine-show="showModal" blur darker>
    <x-slot:header>Title</x-slot:header>
    <x-slot:body>Content</x-slot:body>
</x-ui.modal>

Features

  • Alpine.js integration (default)
  • Livewire wire:model support
  • Smooth animations (fade + scale)
  • Backdrop blur effect
  • ESC key support
  • Click outside to close
  • Dark mode support
  • Accessibility (ARIA attributes)
  • Multiple size options
  • Flexible slot system