webbingbrasil/filament-copyactions
Install the package:
composer require webbingbrasil/filament-copyactions
Ensure version compatibility with your Filament major version (check the compatibility table).
Publish assets (if needed):
php artisan vendor:publish --provider="WebbingBrasil\FilamentCopyActions\FilamentCopyActionsServiceProvider"
First use case:
Replace a standard TextColumn with CopyTextColumn in your Filament table:
use WebbingBrasil\FilamentCopyActions\Columns\CopyTextColumn;
CopyTextColumn::make('name')
->label('Full Name')
->copyable(),
Dynamic Copy Actions in Tables
CopyAction for bulk or row-level copying:
use WebbingBrasil\FilamentCopyActions\Actions\CopyAction;
CopyAction::make('copy_email')
->label('Copy Email')
->action(function (Table $table, array $records) {
$emails = $records->pluck('email')->implode(', ');
return response()->json(['content' => $emails]);
}),
Workflow:
getActions().action() to return JSON with a content key.Copy Field Values
TextInput):
use WebbingBrasil\FilamentCopyActions\Actions\FormCopyAction;
TextInput::make('description')
->extraAttributes(['x-copy-action' => FormCopyAction::make()]),
Integration Tip:
extraAttributes() to avoid modifying field classes.RichEditor, Select).Global Copy Buttons
Pages\CreatePost):
use WebbingBrasil\FilamentCopyActions\Actions\PageCopyAction;
PageCopyAction::make('copy_metadata')
->label('Copy Metadata')
->action(function () {
return ['content' => 'author=John Doe; date=' . now()->format('Y-m-d')];
}),
Best Practice:
getHeaderActions() or getFooterActions().Enhanced TextColumn
TextColumn::make('slug')->copyable(), // Filament 3+
CopyTextColumn::make('slug')
->copyable()
->copyLabel('Copy Slug'),
Advanced Usage:
CopyTextColumn::make('content')
->limit(50)
->copyable()
->copyLabel(fn ($record) => "Copy {$record->title}'s snippet"),
http:// (except localhost).
https:// in production or test locally.content key exists in the JSON response.action() method returns valid data:
return response()->json(['content' => 'test']);
config/filament-copy-actions.php:
'copy_label' => 'Copy to Clipboard',
Custom Tooltips:
Extend the CopyAction class to modify feedback:
CopyAction::make('custom_copy')
->tooltipped(fn ($action) => 'Copied: ' . $action->getContent()),
Async Copy: For large data, use Laravel queues:
CopyAction::make('export_data')
->action(function () {
CopyDataJob::dispatch();
return response()->json(['content' => 'Exporting...']);
}),
action() methods lightweight.
// Slow: Processes all records on copy
CopyAction::make('copy_all')
->action(fn () => HeavyModel::processEverything()),
How can I help you explore Laravel packages today?