Skip to main content

CopyToClipboard

Copies text to the clipboard when the control is activated.

Equivalent to Clipboard.set, but performed by the client inside the user's gesture, which is the only time Safari permits a page to write to the clipboard.

Example
ft.Button("Copy token", action=ft.CopyToClipboard(token))

Inherits: ClientAction

Properties

  • data - The text to copy.

Properties

dataclass-attributeinstance-attribute

data: str = action_field()

The text to copy.

Must be known before the control is activated. To copy something computed at click time, assign it to this action ahead of the click.