Button with Modal Popup

How to create simple link OR button in Filament livewire which ideally open a Modal popup?
Solution:
```html <!-- resources/views/custom-view.blade.php --> <div> <x-filament::modal id="myModal"> <x-slot name="heading">...
Jump to solution
16 Replies
botaviator1990
botaviator199012mo ago
Simple Popup Like Bootstrap Popup window But that's at second stage Currently I'm trying to add a Simple button
LeandroFerreira
LeandroFerreira12mo ago
are you using filament admin panel?
botaviator1990
botaviator199012mo ago
Yes\ TextInput::make('title')->required(), By doing so, I'm able to creat a text box but in similar way I like to create a button But as far as I considered the documentation I didn't find suitable control in From builder list
LeandroFerreira
LeandroFerreira12mo ago
there is modal on Filament
botaviator1990
botaviator199012mo ago
Thanks and Yes certainly I may find out a way for adding a Modal But Here my point is how to add Button
Solution
LeandroFerreira
LeandroFerreira12mo ago
<!-- resources/views/custom-view.blade.php -->
<div>
<x-filament::modal id="myModal">
<x-slot name="heading">
Title
</x-slot>

<div>
Content...
</div>

<x-slot name="footer">
<x-filament::button type="button" @click="$dispatch('close-modal', {id: 'myModal'})">Close</x-filament::button>
</x-slot>
</x-filament::modal>

<x-filament::button type="button" @click="$dispatch('open-modal', {id: 'myModal'})">Open Modal</x-filament::button>
</div>
<!-- resources/views/custom-view.blade.php -->
<div>
<x-filament::modal id="myModal">
<x-slot name="heading">
Title
</x-slot>

<div>
Content...
</div>

<x-slot name="footer">
<x-filament::button type="button" @click="$dispatch('close-modal', {id: 'myModal'})">Close</x-filament::button>
</x-slot>
</x-filament::modal>

<x-filament::button type="button" @click="$dispatch('open-modal', {id: 'myModal'})">Open Modal</x-filament::button>
</div>
Forms\Components\View::make('custom-view')
Forms\Components\View::make('custom-view')
botaviator1990
botaviator199012mo ago
I tried by adding above piece of code but it's showing an error
botaviator1990
botaviator199012mo ago
LeandroFerreira
LeandroFerreira12mo ago
use Filament\Forms\Components\View;
botaviator1990
botaviator199012mo ago
Already added
LeandroFerreira
LeandroFerreira12mo ago
share the whole code following #✅┊rules View::make('custom-view') instead of Forms\Components\View::make('custom-view')
botaviator1990
botaviator199012mo ago
Thank you, Its working I need to pass relationship data in custom view, So How can I manage this thing?
LeandroFerreira
LeandroFerreira12mo ago
$getRecord()
Mark Andrew
Mark Andrew12mo ago
@leandro_ferreira , I have a question on this question. Actually, I'm also facing similar issue. But when I try to do this it's saying Relationship doesn't exist. Am i doing anything wrong ?
LeandroFerreira
LeandroFerreira12mo ago
hey, sorry for the delay. Can you open a new topic and share the code please?