Actions
Copy to Clipboard

copyToClipboard

copyToClipboard action allows users to copy text or content to their device's clipboard with a simple interaction, facilitating easy sharing and transfer of information within the app, enhancing productivity and user convenience.

Properties

PropertyTypeDescription
valuestringThe text to copy to clipboard
onSuccessactionExecute another Action upon successful copy to clipboard
onFailureactionExecute an Action when copy to clipboard fails

Example

View:
  header:
    title: "Action: copyToClipboard"
  styles:
    scrollableView: true
 
  body:
    Column:
      styles:
        gap: 16
        padding: 24
 
      children:
        - Markdown:
            text: |
              Use the `copyToClipboard` action to copy a value to the clipbaord.
 
        - TextInput:
            label: Value to copy
            id: textInput
            value: Hello there
        - Button:
            label: Copy to clipboard
            onTap:
              copyToClipboard:
                value: ${textInput.value}
                onSuccess:
                  showToast:
                    message: ${textInput.value} + "copied!"
                    options:
                      dismissable: true
                      type: success
                      duration: 3
                onFailure:
                  showToast:
                    message: ${textInput.value} + "copied!"
                    options:
                      dismissable: true
                      type: error
                      duration: 3

complete example here (opens in a new tab)