For the complete documentation index, see llms.txt. This page is also available as Markdown.

βœ‚οΈClipboard

Copy text to and read text from the device clipboard within your app.

What is Clipboard?

The Clipboard feature lets your app interact with the device clipboard - copying text programmatically or reading whatever the user has previously copied. This is useful for one-tap copy actions like referral codes, wallet addresses, tracking numbers, or any text your users might want to share or reuse elsewhere.

Prerequisites

Implementation

Choose your integration method below: Bubble.io Plugin (No-Code), JavaScript SDK (Code), or AI Agents (for AI-powered editors like Lovable, Base44, and Replit).

Initialization

Check Plugin

Before starting, verify if the Natively plugin is already installed in your Bubble project.

  1. Open your Bubble editor and navigate to the Plugins tab in the left sidebar.

  2. Check Installed Plugins: Look through your list of installed plugins for "Natively iOS & Android app builder".

    • If it IS installed: Check the version number. If an update is available (e.g., you see a button saying "Update"), click it to ensure you have the latest features and bug fixes.

  • If it is NOT installed: Click the + Add plugins button, search for "Natively", and click Install.

Setup logic

[Element] Natively - Clipboard

Events:

  • Clipboard value received - fires when a text value is successfully retrieved from the clipboard.

States:

  • Latest clipboard value - the text currently stored in the device clipboard.

Actions:

  • Copy text to clipboard - copies the provided text to the device clipboard:

    • text - the plain text string to copy.

  • Get text from the clipboard - reads the current text value from the device clipboard. Listen to the Clipboard value received event to access the result.

How to use

One-tap copy

The most common use case is a copy button next to a piece of text - a referral code, promo code, wallet address, or invite link. Trigger clipboard.copy() on button click and optionally show a Toast/Banner confirmation so the user knows the copy was successful.

Reading clipboard on app open

You can read the clipboard when a page loads to pre-fill a form field - for example, if a user copied a promo code from another app before opening yours. Use clipboard.paste() on page load, and populate the relevant input field with the result.

No permission required

Unlike some other device features, the Clipboard does not require any permission request on iOS or Android. It works silently in the background.

Troubleshooting

Paste method returns empty text

The clipboard may be empty, or the user hasn't copied anything yet. Always handle the case where resp.text is empty or null in your callback before using the value.

Copied text not appearing in another app

Verify that clipboard.copy() is being triggered correctly by logging the text value before passing it to the method. Ensure the text is a plain string - objects or arrays are not supported.

Clipboard not working in Preview

The Clipboard feature works in the Natively Preview app. If you experience issues, try triggering a full build and testing on a real device.

Last updated