Copy to clipboard action table
Would anyone know an easy way to make an action that copies a certain value to the users clipboard?
Thanks in advance!
10 Replies
at the moment i have this, but i'm really not sure how to implement the already-existing ->copyable() method into this action
It doesn't have to be an action, but i just want some way of copying the
address
text, without showing the entire address in the table data.
preferably a single button with an icon (no text) :phttps://filamentphp.com/docs/3.x/tables/columns/text#allowing-the-text-to-be-copied-to-the-clipboard
You limit the address displayed (if it's too long) and you can make use of this link
That's a pretty good (and simple) solution, thanks @Vp !
Would you know if it's possible to make some copy button for in the forms too?
Not sure, because I don't know how to write copyable code using PHP.. if you can hook some JS then you can achieve maybe 🤣
yeah but doing that from Filament would be tough hahaha
Not sure, because using your main idea may achieve, you create Action, inside
->action()
in Action you call JS (this js part I don't know rn) then you may achieve..Maybe check the copyable implementation and adapt to your needs
yes but then it would be pretty ugly code, calling JS from a filament action lol
I'll check that out, thanks!
Filament\Support\Concerns\CanBeCopied
is a trait though, so i'm not sure how i would implement that onto TextArea hahahha
The only solution I would be able to think of is making a copy of TextArea
, and make sure it uses CanBeCopied
, but I'm not even sure if that would work, and if that is the best solution for this.
@Dennis Koch Do you think this would work, or did you mean something else with a copyable implementation?Why Textarea? I thought you want to use this on an action?!
The action i've replaced with a textcolumn that's copyable. Now i'm also trying to get the same copyable functionality onto the view page of my user resource
I was trying to get the forms to work too https://discord.com/channels/883083792112300104/1171395108931907614/1171397523299106916
Not sure if this is possible though