FilamentF
Filamentβ€’2y 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\')')
Was this page helpful?