Download the PHP package lao9s/livewire-modal-twitter without Composer
On this page you can find all versions of the php package lao9s/livewire-modal-twitter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package livewire-modal-twitter
About Livewire Modal Twitter
Livewire component that provides a modal like on Twitter. Also, it supports images gallery with content or without.
Installation
To get started, require the package via Composer:
Livewire directive
Add the Livewire directive @livewire('livewire-modal-twitter')
and also the Javascript @livewireModalTwitterScript
directive to your template.
Next you will need to publish the required scripts with the following command:
Alpine
Livewire Modal Twitter requires Alpine. You can use the official CDN to quickly include Alpine:
TailwindCSS
This modal is made with TailwindCSS. You can use the official CDN to quickly include TailwindCSS:
If you use a different CSS framework I recommend that you publish the modal templates and change the markup to include the required classes for your CSS framework.
Creating modal
You can run php artisan make:livewire ShowPost
to make the initial Livewire component. Open your component class and
make sure it extends the ModalTwitterComponent
class:
If you need to load data inside of your livewire component, you need to use method dispatch() instead mount(), also for display preloading you has in hasLoading() return to true:
Blade
In your blade Livewire component show-post.blade.php
, you has to use standard laravel component livewire-modal-twitter::dialog
:
Opening a modal
To open a modal you will need to emit an event. To open the ShowPost
modal for example:
Passing parameters
You can pass parameters like images
or post_id
:
The parameters are passed to the mount
method on the modal component:
Security
If you are new to Livewire, I recommend to take a look at the security details. In short, it's very important to validate all information given Livewire stores this information on the client-side, or in other words, this data can be manipulated.
Credits
- Dumitru Botezatu
- All Contributors
License
Livewire Modal Twitter is open-sourced software licensed under the MIT license.