Copied to clipboard on suffix action
By: Lalhmangaihenga
- Published: 08 Apr 2024 Updated: 08 Aug 2026
Custom copy action, click the icon to copy the content
1use Filament\Forms\Components\Actions\Action;
2
3Forms\Components\TextInput::make('copyContent')
4 ->suffixAction(
5 Action::make('copy')
6 ->icon('heroicon-s-clipboard-document-check')
7 ->action(function ($livewire, $state) {
8 $livewire->js(
9 'window.navigator.clipboard.writeText("'.$state.'");
10 $tooltip("'.__('Copied to clipboard').'", { timeout: 1500 });'
11 );
12 })
13 ),
Related Tricks:
Trigger hint action on hover
toggle the visibility of an action when hover the component
Copied to clipboard on suffix action
Custom copy action, click the icon to copy the content
Sticky Actions In Forms
Bring the sticky actions back form filament v2
Bypass required when save as draft
Unrequire fields recursively when saving as draft
Use translatable for relations in select components
get translatable attribute in a relationships