F
Filamentβ€’2mo 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β€’2mo ago
Action::make('copyDetails')
->alpineClickHandler('window.navigator.clipboard.writeText(\'your text\')')
Action::make('copyDetails')
->alpineClickHandler('window.navigator.clipboard.writeText(\'your text\')')
RuZZZZ
RuZZZZβ€’2mo ago
Man, you are awesome πŸ™‚ !!