Livewire Toggle switch with alert notification

Tech Stack: bootstrap-5, new, livewire

Demo

Name Email Active
Anjali Jacobs sister.streich@example.net
Laron Schneider mclaughlin.carmelo@example.net
Dr. Uriel Senger II anderson.elnora@example.com
Miss Katelyn Ziemann lmarquardt@example.net
Frederique Mitchell linwood.reynolds@example.com
Milo Hagenes PhD bernard12@example.net
Turner Tremblay afriesen@example.org
Dr. Zakary O'Kon V hudson.dandre@example.net
Sydney Effertz sienna.wilkinson@example.net
Jorge Lakin antwan.thiel@example.org

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.