{"id":15016913,"url":"https://github.com/aliqasemzadeh/livewire-bootstrap-modal","last_synced_at":"2025-04-12T10:42:21.767Z","repository":{"id":56945625,"uuid":"463380903","full_name":"aliqasemzadeh/livewire-bootstrap-modal","owner":"aliqasemzadeh","description":"Dynamic Laravel Livewire Bootstrap modals.","archived":false,"fork":false,"pushed_at":"2024-03-15T07:35:38.000Z","size":60,"stargazers_count":32,"open_issues_count":2,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-15T08:43:49.610Z","etag":null,"topics":["boostrap","bootstrap5","laravel","laravel-livewire","livewiere","livewire-bootstrap-modal","livewire-component","livewire-laravel","livewire-modal","modal"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aliqasemzadeh.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-25T03:16:20.000Z","updated_at":"2024-08-08T20:25:15.771Z","dependencies_parsed_at":"2024-03-15T08:47:13.922Z","dependency_job_id":null,"html_url":"https://github.com/aliqasemzadeh/livewire-bootstrap-modal","commit_stats":{"total_commits":9,"total_committers":3,"mean_commits":3.0,"dds":0.2222222222222222,"last_synced_commit":"14d25e1b913941585692c1523a960bacba1eefbf"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliqasemzadeh%2Flivewire-bootstrap-modal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliqasemzadeh%2Flivewire-bootstrap-modal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliqasemzadeh%2Flivewire-bootstrap-modal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliqasemzadeh%2Flivewire-bootstrap-modal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aliqasemzadeh","download_url":"https://codeload.github.com/aliqasemzadeh/livewire-bootstrap-modal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557204,"owners_count":21124156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boostrap","bootstrap5","laravel","laravel-livewire","livewiere","livewire-bootstrap-modal","livewire-component","livewire-laravel","livewire-modal","modal"],"created_at":"2024-09-24T19:49:33.599Z","updated_at":"2025-04-12T10:42:21.745Z","avatar_url":"https://github.com/aliqasemzadeh.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Livewire Modals\n\nThis package allows you to dynamically show your Laravel Livewire 3 components inside Bootstrap modals.\n\n **Warning:** This package is not backward compatible with Livewire 2.\n\n## Documentation\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Modal Views](#modal-views)\n    - [Showing Modals](#showing-modals)\n    - [Mount Parameters](#mount-parameters)\n    - [Hiding Modals](#hiding-modals)\n    - [Dispatching Modals](#dispatching-modals)\n    - [Custom modal size](#custom-modal-size)\n- [Publishing Assets](#publishing-assets)\n    - [Custom View](#custom-view)\n- [Notes](#notes)\n\n## Requirements\n\n- Bootstrap 5 and PopperJS must be installed via npm first\n```console\nnpm install bootstrap\nnpm install @popperjs/core\n```\n\n## Installation\n\n\nRequire the package:\n\n```console\ncomposer require aliqasemzadeh/livewire-bootstrap-modal\n```\n\nAdd the `livewire:modals` component to your app layout view:\n\n```html\n\u003clivewire:modals/\u003e\n\u003clivewire:scripts/\u003e\n\u003cscript src=\"{{ asset('js/app.js') }}\"\u003e\u003c/script\u003e\n```\n\nRequire `../../vendor/aliqasemzadeh/livewire-bootstrap-modal/resources/js/modals` in your app javascript file:\n\n```javascript\nimport('@popperjs/core');\nimport '../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js';\nimport '../../vendor/aliqasemzadeh/livewire-bootstrap-modal/resources/js/modals.js';\n```\n\n## Usage\n\n### Modal Views\n\nMake a Livewire component you want to show as a modal. The view for this component must use the Bootstrap `modal-dialog` container:\n\n```html\n\u003cdiv\u003e\n        \u003cdiv class=\"modal-header\"\u003e\n            \u003ch5 class=\"modal-title\"\u003eModal title\u003c/h5\u003e\n            \u003cbutton type=\"button\" class=\"btn-close\" wire:click=\"$dispatch('hideModal')\" aria-label=\"Close\"\u003e\u003c/button\u003e\n        \u003c/div\u003e\n        \u003cdiv class=\"modal-body\"\u003e\n            \u003cp\u003eModal body text goes here.\u003c/p\u003e\n        \u003c/div\u003e\n        \u003cdiv class=\"modal-footer\"\u003e\n            \u003cbutton type=\"button\" class=\"btn btn-secondary\"  wire:click=\"$dispatch('hideModal')\"\u003eClose\u003c/button\u003e\n            \u003cbutton type=\"button\" class=\"btn btn-primary\"\u003eSave changes\u003c/button\u003e\n        \u003c/div\u003e\n\u003c/div\u003e\n \n```\n\n### Showing Modals\n\nShow a modal by emitting the `showModal` event with the component alias:\n\n```html\n\u003cbutton type=\"button\" wire:click=\"$dispatch('showModal', {data: {'alias' : 'livewire.modal.user','params' :{'user':'Ali Qasemzadeh'}}})\"\u003e\n    {{ __('Update Profile') }}\n\u003c/button\u003e\n```\n\n### Mount Parameters\n\nPass parameters to the component `mount` method after the alias:\n\n```html\n\u003cbutton type=\"button\"wire:click=\"$dispatch('showModal', {data: {'alias' : 'livewire.modal.user','params' :{'user':'Ali Qasemzadeh'}}})\"\u003e\n    {{ __('Update User #' . $user-\u003eid) }}\n\u003c/button\u003e\n```\n\nThe component `mount` method for the example above would look like this: \n\n```php\nnamespace App\\Http\\Livewire\\Users;\n\nuse App\\Models\\User;\nuse Livewire\\Component;\n\nclass Update extends Component\n{\n    public $user;\n    \n    public function mount(User $user)\n    {\n        $this-\u003euser = $user;\n    }\n    \n    public function render()\n    {\n        return view('users.update');\n    }\n}\n```\n\n### Hiding Modals\n\nHide the currently open modal by emitting the `hideModal` event:\n\n```html\n\u003cbutton type=\"button\" wire:click=\"$dispatch('hideModal')\"\u003e\n    {{ __('Close') }}\n\u003c/button\u003e\n```\n\n\n### Dismissing Modals\n\nYou can emit events inside your views:\n\n```html\n\u003cbutton type=\"button\" wire:click=\"$dispatch('hideModal')\"\u003e\n    {{ __('Close') }}\n\u003c/button\u003e\n```\n\nOr inside your components, just like any normal Livewire event:\n\n```php\npublic function save()\n{\n    $this-\u003evalidate();\n\n    // save the record\n\n    $this-\u003edispatch('hideModal');\n}\n```\n\n### Custom modal size\n\nNow you can have custom modal size by default we use `modal-lg`:\n\n```html\n\u003cbutton type=\"button\"wire:click=\"$dispatch('showModal', {data: {'alias' : 'livewire.modal.user','size' :'modal-xl')\"\u003e\n  {{ __('Show XL Modal') }}\n\u003c/button\u003e\n```\n\n## Publishing Assets\n\n### Custom View\n\nUse your own modals view by publishing the package view:\n\n```console\nphp artisan vendor:publish --tag=livewire-bootstrap-modal:views\n```\n\nNow edit the view file inside `resources/views/vendor/livewire-bootstrap-modal`. The package will use this view to render the component.\n\n\n\n## Notes\n\n1- You should use button or @click in main slot.\n\n2- We are working hard on some problems, We hope fix them soon.\n\n3- We will add some options soon.\n\n4- wire:navigate not work (just first modal open).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliqasemzadeh%2Flivewire-bootstrap-modal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliqasemzadeh%2Flivewire-bootstrap-modal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliqasemzadeh%2Flivewire-bootstrap-modal/lists"}