© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•10mo ago•
1 reply
Alberto

Action Notify from onClick

I want to copy the content of a input field. And it works, but i want to notify it. The dispatch is not working.

Maybe i'm over complicating it.

                            TextInput::make("sis")
                                ->label("SIS")
                                ->columnSpan(3)
                                ->required()
                                ->suffixAction(
                                    Action::make("copy")
                                        ->icon("heroicon-m-clipboard-document")
                                        ->tooltip("Copiar")
                                        ->extraAttributes([
                                            "x-on:click" => new \Illuminate\Support\HtmlString("
                                                const wrapper = \$el.closest('.fi-input-wrp');
                                                const input = wrapper?.querySelector('.fi-input');

                                                if (input) {
                                                    navigator.clipboard.writeText(input.value);
                                                    \$dispatch('notify', { type: 'success', message: 'Copiat!' });
                                                } else {
                                                    console.log('Input not found');
                                                }
                                            "),
                                        ])
                                )
                            TextInput::make("sis")
                                ->label("SIS")
                                ->columnSpan(3)
                                ->required()
                                ->suffixAction(
                                    Action::make("copy")
                                        ->icon("heroicon-m-clipboard-document")
                                        ->tooltip("Copiar")
                                        ->extraAttributes([
                                            "x-on:click" => new \Illuminate\Support\HtmlString("
                                                const wrapper = \$el.closest('.fi-input-wrp');
                                                const input = wrapper?.querySelector('.fi-input');

                                                if (input) {
                                                    navigator.clipboard.writeText(input.value);
                                                    \$dispatch('notify', { type: 'success', message: 'Copiat!' });
                                                } else {
                                                    console.log('Input not found');
                                                }
                                            "),
                                        ])
                                )
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Change Action Label from action method
FilamentFFilament / ❓┊help
3y ago
Open an action from another action
FilamentFFilament / ❓┊help
3y ago
Notify for validation errors
FilamentFFilament / ❓┊help
3y ago
Mount action from resource
FilamentFFilament / ❓┊help
15mo ago