Download the PHP package akhaled/livewire-sweetalert without Composer
On this page you can find all versions of the php package akhaled/livewire-sweetalert. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download akhaled/livewire-sweetalert
More information about akhaled/livewire-sweetalert
Files in akhaled/livewire-sweetalert
Package livewire-sweetalert
Short Description Integration Sweetalert with Livewire
License MIT
Informations about the package livewire-sweetalert
Livewire Sweetalert
Integrate livewire with Sweetalert.
- Installation
- How to use
- Toast
- Fire
- Confirm
- Multiple confirmation component
- Using PHP 8 Attribute
- Passing event data
- Available configuration
Installation
composer require akhaled/livewire-sweetalert
How to use
1. Include javascript
2. Extra config file
Publish the configs: php artisan vendor:publish --tag=livewire-sweetalert-config
.
See available configuration
Toast
In your component add Toast
trait. Then call toast
method whenever you want.
toast parameters:
- title
- icon: success, error, warning, info, question - default is info
- timeout: in milliseconds, default is 5000
Fire
This is the normal sweetalert modal. In your component add Fire
trait. Then call fire
method whenever you want.
fire parameters:
- titleText: The title of the popup, as text to avoid HTML injection.
- icon: success, error, warning, info, question - default is info.
- html: the html which is displayed under the title.
- options: all options that sweetalert provides.
Confirm
Add Confirm
trait to your component. Then call confirm
method whenever you want. On confirmation, confirmed
event is being emitted. Add it to $listeners
property in you component. See example:
confirm parameters:
- title: The title of the popup, as text to avoid HTML injection.
- html: the html which is displayed under the title.
- options: all options that sweetalert provides. In addition to event key for using multiple confirmation on same component. see following example