Livewire Toggle switch with alert notification

Tech Stack: bootstrap-5, new, livewire

Demo

Name Email Active
Ms. Meghan Hagenes alanna.reynolds@example.org
Prof. Marilyne Thompson lcollins@example.org
Blake Mann harry.schultz@example.net
Raegan Doyle sonya35@example.org
Pietro Fadel jameson.cormier@example.com
Elvera Cormier emanuel58@example.com
Ardella Grimes naomie.jacobi@example.net
Prof. Zachary Keeling ahudson@example.com
Dr. Shaniya Weissnat V bins.rocio@example.net
Miss Shayna DuBuque cormier.trystan@example.net

Code
Please login to View/Download the Code

Sorry, this component's code is restricted
Get Livewiredemos-Pro
Sorry, this component's code is restricted
Get Livewiredemos-Pro

Usage


      @livewire('toggle-switch-alert', [
                        'model' => $dummyUser,
                        'field' => 'isActive',
                        'status' => [
                            'off' => "User {$dummyUser->name} is disabled",
                            'on' => "User {$dummyUser->name} is enabled"
                        ]
                    ])
    

Documentation

This component is an extention of Simple Toggle Switch Component

This is a toggle-switch with an alert livewire component using bootstrap-5 which alters the boolean field in the database and also shows an alert notification to the user.

For the alerts, we have done a simple integration with Notyf javascript plugin. You can read more about Livewire Notyf Integration.