F
Filamentβ€’7mo ago
RuZZZZ

Button->Action to copy text?

protected function getActions(): array { return [ ButtonAction::make('copyDetails') ->label('Copy Details') ->color('primary') ->action('copyDetailsToClipboard') ]; } Is it possible to make this button copy text (obtained from the service or the model) to the user's clipboard? If yes, please kindly point me πŸ™‚ Thanks!!
Solution:
Action::make('copyDetails')
->alpineClickHandler('window.navigator.clipboard.writeText(\'your text\')')
Action::make('copyDetails')
->alpineClickHandler('window.navigator.clipboard.writeText(\'your text\')')
...
Jump to solution
2 Replies
Solution
LeandroFerreira
LeandroFerreiraβ€’7mo ago
Action::make('copyDetails')
->alpineClickHandler('window.navigator.clipboard.writeText(\'your text\')')
Action::make('copyDetails')
->alpineClickHandler('window.navigator.clipboard.writeText(\'your text\')')
RuZZZZ
RuZZZZOPβ€’7mo ago
Man, you are awesome πŸ™‚ !!
Want results from more Discord servers?
Add your server