A flexible and customizable dialog component for user interaction.
Default modal with a title and content.
<x-ui::button x-on:click="$dispatch('open-modal', { id: 'basic-modal' })">
Open Modal
</x-ui::button>
<x-ui::modal id="basic-modal" title="Welcome">
This is a basic modal example.
</x-ui::modal>
Use the maxWidth prop to control the width of the modal.
<x-ui::modal id="sm-modal" maxWidth="sm" title="Small Modal">...</x-ui::modal>
<x-ui::modal id="lg-modal" maxWidth="lg" title="Large Modal">...</x-ui::modal>
You can open or close any modal by dispatching window events.
Use Alpine.js's $dispatch helper or standard JavaScript window.dispatchEvent to control modals from anywhere in your application.
// To open a modal
$dispatch('open-modal', { id: 'modal-id' });
// To close a modal
$dispatch('close-modal', { id: 'modal-id' });