smirltech/livewire-modals
Larablocks Analysis
smirltech/livewire-modals works with Laravel 8, 9 and 10 (latest release v2.2.2, Dec 2, 2023), all past end of life (the last on Feb 4, 2025): no more fixes, even for security.
Recommendation checks
Use with careUse with care: meets 0 of 4 checks.
- Supports only Laravel 8, 9 and 10, past end of life since Feb 4, 2025
- No release in the last 12 months (last: Dec 2, 2023)
- 713 downloads a month (needs 10,000)
- 2 GitHub stars (needs 100)
State
Quiet- Last stable release: Dec 2, 2023.
- No releases in the last 12 months.
- First released: Feb 19, 2023.
- Monthly downloads: 713, up 2277% from six months ago.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.
| Install | |
|---|---|
composer require smirltech/livewire-modals |
|
| Latest Version: | v2.2.2 |
| PHP: | ^8.0 |
| Laravel: | 8 · 9 · 10 |
| License: | MIT |
| Last Updated: | Feb 25, 2025 |
| Links: | GitHub · Packagist |

Livewire Modals
This package allows you to dynamically show your Laravel Livewire components inside Bootstrap modals.
Documentation
Requirements
Install Bootstrap 5 and Popper.js 2 in your app. See the Bootstrap 5 docs for more information.
npm install bootstrap @popperjs/core
Require bootstrap and popper.js packages in your
app javascript file. Then import the Modal class from bootstrap and add it to the window object.
Using mix
require('@popperjs/core');
require('bootstrap');
import {Modal} from 'bootstrap';
window.Modal = Modal;
Using vite
import('@popperjs/core');
import('bootstrap');
import {Modal} from 'bootstrap';
window.Modal = Modal;
Installation
Require the package:
composer require smirltech/livewire-modals
Add livewire:modals and x-modals::scripts components to your layout:
<livewire:modals/>
<livewire:scripts/>
<script src="{{ asset('js/app.js') }}"></script>
<x-modals::scripts/>
Usage
Modal Views
Make a Livewire component you want to show as a modal. The view for this component must use the Bootstrap modal-dialog
container:
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal title</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>Modal body text goes here.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
Alternatively, you can use the x-modals::base or x-modals::form component:
<x-modals::base title="Modal title">
Modal body text goes here.
</x-modals::base>
Showing Modals
Show a modal by emitting the showModal event with the component alias:
<button type="button" wire:click="$emit('showModal', 'auth.profile-update')">
{{ __('Update Profile') }}
</button>
Outside of Livewire components, you can use the Livewire.emit method:
<button type="button" onclick="showModal('auth.profile-update')">
{{ __('Update Profile') }}
</button>
or
<script>
Livewire.emit('showModal', 'auth.profile-update');
</script>
Mount Parameters
Pass parameters to the component mount method after the alias:
<button type="button" wire:click="$emit('showModal', 'users.update', '{{ $user->id }}')">
{{ __('Update User #' . $user->id) }}
</button>
The component mount method for the example above would look like this:
namespace App\Http\Livewire\Users;
use App\Models\User;
use Livewire\Component;
class Update extends Component
{
public $user;
public function mount(User $user)
{
$this->user = $user;
}
public function render()
{
return view('users.update');
}
}
Hiding Modals
Hide the currently open modal by emitting the hideModal event:
<button type="button" wire:click="$emit('hideModal')">
{{ __('Close') }}
</button>
Or by using the Bootstrap data-bs-dismiss attribute:
<button type="button" data-bs-dismiss="modal">
{{ __('Close') }}
</button>
Emitting Events
You can emit events inside your views:
<button type="button" wire:click="$emit('hideModal')">
{{ __('Close') }}
</button>
Or inside your components, just like any normal Livewire event:
public function save()
{
$this->validate();
// save the record
$this->emit('hideModal');
}
Publishing Assets
Custom View
Use your own modals view by publishing the package view:
php artisan vendor:publish --tag=livewire-modals:views
Now edit the view file inside resources/views/vendor/livewire-modals. The package will use this view to render the
component.
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v2.2.2 | ^8.0 | ^10.0| | MIT | |
| v2.2.1 | ^8.0 | ^10.0| | MIT | |
| v2.2.0 | ^8.0 | ^10.0| | MIT | |
| v2.1.1 | ^8.0 | ^10.0| | MIT | |
| v2.1.0 | ^8.0 | ^10.0| | MIT | |
| v2.0.1 | ^8.0 | ^10.0| | MIT | |
| v2.0.0 | ^8.0 | ^10.0| | MIT | |
| v1.0.1 | ^8.0 | ^10.0| | MIT | |
| v1.0.0 | ^8.0 | ^10.0| | MIT |