Download the PHP package cloudmeshdev/livewire-slideover without Composer
On this page you can find all versions of the php package cloudmeshdev/livewire-slideover. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cloudmeshdev/livewire-slideover
More information about cloudmeshdev/livewire-slideover
Files in cloudmeshdev/livewire-slideover
Package livewire-slideover
Short Description Laravel Livewire slideover component
License MIT
Informations about the package livewire-slideover
What is?
A package that allow overlapping (virtually) infinite slideovers simultaneously with configurable widths. This package is based upon aristridely/slideover (thanks [Aristotele Tufano] (https://github.com/ariStridely)) which is a fork of wire-elements/modal (thanks Philo Hermans).
Installation
To get started, require the package via Composer:
Livewire directive
Add the Livewire directive @livewire('livewire-ui-slideover')
to your template.
Alpine
Alpine is already combined with Livewire v3
TailwindCSS
The base slideover template is made with TailwindCSS. If you use a different CSS framework I recommend that you publish the slideover template and change the markup to include the required classes for your CSS framework.
Creating a slideover
You can run php artisan make:livewire EditUserSlideover
to make the initial Livewire component. Open your component class and make sure it extends the SlideoverComponent
class:
Opening a slideover
To open a slideover you will need to dispatch an event. To open the EditUserSlideover
slideover for example:
Passing parameters
To open the EditUserSlideover
slideover for a specific user we can pass the user id (notice the single quotes):
The parameters are passed to the mount
method on the slideover component:
Overlapping slideover
From an existing slideover you can use the exact same event and another slideover will stack onto the first:
Closing a slideover
When you are done with the current slideover, you can close it by dispatching the closeSlideover
event.
This will always close the most recent (in the foreground) slideover.
(N.B. at the moment, each time you close a slideover, the relative component's state will be destroyed).
You can also close a slideover from within your slideover component class:
Configure slideover width
You can change the width of the slideover in 2 ways. (N.B. At the moment the width of the slideover is configurable by a CSS class, in this case a TailwindCSS one).
Static way
Declare this method inside your class. Usefull when you know the slideover will always have the same width.
Dynamic way
This approach is usefull when the slideover is opened on top of another slideover and you want to let the background one visible adapting the width of the new slidevoer in the foreground.
Difference with aristridely/slideover
- re-enabled closing slideover with
escape
key - re-enabled closing slideover by clicking outside of it (close on click away)
Combine with wire-elements/modal
This package can be used together with wire-elements/modal
. The recommended way is to declare it before the modal package, as follow:
This will ensure that the modal element will always be on top of the slideover one.
Warning:
Closing on escape and on clickaway will collide with the modal behavior.
E.g. If a modal is opened on top of a slideover, by pressing escape
both will be closed.
Configuration
You can (partially) customize the Slideover via the livewire-ui-slideover.php
config file.
(Actually only default width class).
To publish the config run the vendor:publish command: