Download the PHP package larawire-garage/larawire-modals without Composer
On this page you can find all versions of the php package larawire-garage/larawire-modals. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download larawire-garage/larawire-modals
More information about larawire-garage/larawire-modals
Files in larawire-garage/larawire-modals
Package larawire-modals
Short Description Modal window with Livewire
License MIT
Informations about the package larawire-modals
Modal Dialogs with Livewire 3
👉 For Backend Coding Enjoyers 😉
Create modal dialog easily with laravel project with livewire 3 + Alpinejs & manage modal dialog as livewire component.
Still on beta version
- Installation
- Setup
- Publish Configurations
- Themes
- Bootstrap Installation
- Tailwind Installation
- Change Theme
- Usage
- Create Modal
- Show Modal
- Hide Modal
- Options
- Available Options
- Methods
- Add Form
- Customizaion
- Animation
- Not Working ?
Installation
Setup
publish configurations
Themes
Currently supports 2 themes.
- Bootstrap
- Tailwind
Bootstrap Installation
You can use CDN Link to apply bootstrap.
If you are using package managers like npm
use Bootstrap Documentation to install.
When Importing Bootstrap add below code to app.js
file.
Tailwind Installation
You can use CDN Link to apply Tailwindcss.
If you are using package managers like npm
use Tailwindcss Documentation to install. Then Add below code to tailwind.config.js
file.
If not working correctly? Check Here
Change Theme
You can add theme your proejct used in larawire-modals
config file.
Also you can change theme in your modal variable inside the modal component.
Usage
create modal component using below command.
Now you can use modal component like regular livewire component. By default this command create component:
Class
: app/Livewire/ModalsView
: resources/views/livewire/modals
directories. You can change it in the larawire-modals
config file.
ModalComponent is a regular Livewire component. You can do everything normal Livewire component can do.
- Fire or listen events with parameters
- Parse parameters to component
- Call functions etc...
By Default ModalComponent listen 2 events
- show [parameters parse to beforeShow function]
- hook : beforeShow(...$args)
- close [parameters not supported yet]
- hook : beforeClose()
To show the modal dialog
dispatch show
event to "your-modal-component".
To close the modal dialog
-
From other component:
- From modal component:
Options
Modal component has $modal
public variable containing modal options.
Available Options
id
- Modal IDtitle
- Modal title text on the headertheme
- Theme using in the project (bootstrap or tailwind). Can be defind in the larawire-modals config fileresetBeforeShow
- if this is true, public variables in the modal component automatically reset before show the modal. Can be defind in the larawire-modals config fileresetValidationBeforeShow
- if this is true, Reset the validation error bag of modal component automatically before show the modal. Can be defind in the larawire-modals config file
Methods
showModal()
- Show the modal dialogcloseModal()
- Close the modal dialog
You can define:
beforeShow()
- Runs before show the modal dialogbeforeClose()
- Runs before close the modal dialog
Add Form
If your modal contains form, add formSubmit attribute to modal component.
When formSubmit
attribute defined, modal body
and footer
slots automatically covered by form tag with wire:submit="[form-submit-value]"
attribute.
Customizaion
In the larawire-modals config file you can change classes of the containers of the modal. Also can change in the modal variable of the modal component.
Changing classes still not working for you ? To customize appearance of the modal, you can publish the views and edit it.
Animation
Also you can change animation of the modal.
Bootstrap Theme
:
In bootstrap, follow bootstrap documentation to change the modal animation.
Tailwind Theme
:
In tailwind theme under animation
key in them larawire-modals config file.
Also you can change it in the modal variable in the modal component.
For deep customize animation classes check under animation-classes
key in larawire-modals config file.
In Tailwind theme, modal use alpinejs & tailwindcss animation classes to animate modals.
Not Working Correctly
Tailwind
In case modal not working correctly, Eg:
- Modal not rendering correctly
- Animation not working
Add below array of classes to safelist
array
If you change the classes in config file or in class modal variable, that classes also need to include here
!!! :tada::tada::tada: Enjoy :tada::tada::tada: !!!