V4 How to make a text field copayable?

Adding a suffixIcon and making it clickable should work, but we don't find anything inside the v4 docs that helps us with this.
1 Reply
Alberto
AlbertoOP2mo ago
We are trying something like this DatePicker::make("date") ->columnSpan(2) ->suffixAction( \Filament\Actions\Action::make("copy") ->icon("heroicon-m-clipboard-document") ->tooltip("Copy") ->extraAttributes([ "x-on:click" => new \Illuminate\Support\HtmlString(" const wrapper = $el.closest('.fi-input-wrp'); const input = wrapper?.querySelector('.fi-input'); if (input) { console.log('Input found'); navigator.clipboard.writeText(input.value); $tooltip('Copiat!', { timeout: 1500 }); $dispatch('notify', { type: 'success', message: 'Copied!' }); } else { console.log('Input not found'); } "), ]), )

Did you find this page helpful?