F
Filamentβ€’6mo 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β€’6mo ago
Action::make('copyDetails')
->alpineClickHandler('window.navigator.clipboard.writeText(\'your text\')')
Action::make('copyDetails')
->alpineClickHandler('window.navigator.clipboard.writeText(\'your text\')')
RuZZZZ
RuZZZZOPβ€’6mo ago
Man, you are awesome πŸ™‚ !!
Want results from more Discord servers?
Add your server