F
Filament15mo ago
Ansori

Copyable Action

Filament already has a built-in copy-to-clipboard functionality on the TextColumn and TextEntry. However, this function is not available on filament actions. It would also be nice if this function was in the filament action.
11 Replies
daisy21
daisy2115mo ago
what will the action do?
Ansori
AnsoriOP15mo ago
Copy a text to the clipboard like TextColumn and TextEntry
daisy21
daisy2115mo ago
you want an action when its clicked it will copy more than 1 column?
Ansori
AnsoriOP15mo ago
I want to copy text inside the copyableState
daisy21
daisy2115mo ago
masi gak ngerti gw bang mau actionnya ngapain
Ansori
AnsoriOP15mo ago
Here's a real-world example... I currently have a Media table, it has an ID column that can be copied. TextColumn has copyable() and copyableState() methods that I can use to create that functionality. The problem is: 1. I need to add a "click to copy" label to the column to indicate that the text can be copied. 2. I don't even need the column to display, I just need to copy the text. It would be nice to add a button to the table, with copyable() and copyableState() methods, so I could click the button to copy text instead of using TextColumn.
No description
No description
daisy21
daisy2115mo ago
okay i understand
daisy21
daisy2115mo ago
like this?
No description
DrByte
DrByte15mo ago
Here's what the component does to make the element copyable: https://github.com/filamentphp/filament/blob/50bc3a3700419d5cefc0c9ddcaeb8c70476b36c2/packages/tables/resources/views/columns/text-column.blade.php#L101-L112 You could explore making your own component, or extending the component's template, to suit your needs.
GitHub
filament/packages/tables/resources/views/columns/text-column.blade....
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
Mark Chaney
Mark Chaney15mo ago
@Ansori did you ever work this out?
Ansori
AnsoriOP15mo ago
Actually there is a copyable method on the table action Action::make()->copyable(), but when I tried it the action does nothing. Not sure why is not working for me.
Want results from more Discord servers?
Add your server