← Back to Plugins
  • Copy Actions

Copy Actions

Plugin information

by Danilo Andrade • 7 stars

Admin panel

A easy-to-use copy actions for Filament Admin Pages, Tables and Form Fields.

Support

#copy-actions on Discord

Views

409

License

MIT

Documentation

Installation

composer require webbingbrasil/filament-copyactions

Usage

Table Column

Display a table text column with a copy button, the column has all features of the TextColumn and the copy action send column content to clipboard and display a success tooltip

use Webbingbrasil\FilamentCopyActions\Tables\CopyableTextColumn;
 
CopyableTextColumn::make('brand.name')
->successMessage('Brand copied to clipboard')
->searchable()
->sortable()
->toggleable(),

Table Action

Display a table action button, you set the content using copyable method.

use Webbingbrasil\FilamentCopyActions\Tables\Actions\CopyAction;
 
$table
->actions([
CopyAction::make()->copyable(fn ($record) => $record->name),
])

Form Action

If you want to copy a field value, use the CopyAction in your field suffix or prefix.

use Webbingbrasil\FilamentCopyActions\Forms\Actions\CopyAction;
 
Forms\Components\TextInput::make('sku')
->label('SKU (Stock Keeping Unit)')
->suffixAction(CopyAction::make())
->required();
 
Forms\Components\Select::make('shop_brand_id')
->relationship('brand', 'name')
->prefixAction(CopyAction::make())
->searchable();

You can use this form action in any filament field, the action will copy the field value to clipboard by default, but you can customize the value with the copyable method

use Webbingbrasil\FilamentCopyActions\Forms\Actions\CopyAction;
 
Forms\Components\Select::make('shop_brand_id')
->relationship('brand', 'name')
->prefixAction(CopyAction::make()->copyable(fn ($component) => $component->getOptionLabel()))
->searchable();

Page Action

You can add CopyAction buttom to any page in filament, just put the action in the actions method of the page.

use Webbingbrasil\FilamentCopyActions\Pages\Actions\CopyAction;
 
protected function getActions(): array
{
return [
CopyAction::make()->copyable(fn () => $this->record->name),
];
}