Components
Layouts

Modal

Display content in a layer above the main page. Ideal for confirmations, alerts, and forms.

Update profile
Make changes to your personal details.
Name
Date of birth

Unique modal names

If you are placing modals inside a loop, ensure that you are dynamically generating unique modal names. Otherwise, one modal trigger, will trigger all modals of that name on the page causing unexpected behavior.

Livewire methods

In addition to triggering modals in your Blade templates, you can also control them directly from Livewire.

Consider a "confirm" modal in your Blade template like so:

You can now open and close this modal from your Livewire component using the following methods:

Data binding

If you prefer, you can bind a Livewire property directly to a modal to control its states from your Livewire component.

Consider a confirmation modal in your Blade template like so:

It's important to add the .self modifier to the wire:model attribute to prevent nested elements from dispatching input events that would interfere with the state of the modal.

You can now open and close this modal from your Livewire component by toggling the wire:model property.

One advantage of this approach is being able to control the state of the modal directly from the browser without making a server roundtrip:

Close events

If you need to perform some logic after a modal closes, you can register a close listener like so:

You can also use wire:close or x-on:close if you prefer those syntaxes.

Disable click outside

By default, clicking outside the modal will close it. If you want to disable this behavior, you can use the :dismissible="false" prop.

Confirmation

Prompt a user for confirmation before performing a dangerous action.

Delete project?

You're about to delete this project.

This action cannot be reversed.

Flyout

Use the "flyout" variant for a more anchored and long-form dialog.

Update profile
Make changes to your personal details.
Name
Date of birth
Copyright © 2024 Wireable LLC ·Terms of Service
Built with by
Caleb Porzio and Hugo Sainte-Marie