# Button to copy text to clipboard

**URL:** https://community.thunkable.com/t/button-to-copy-text-to-clipboard/2893541
**Category:** Questions about Thunkable X
**Created:** [March 14, 2024, 6:13pm UTC](https://community.thunkable.com/t/button-to-copy-text-to-clipboard/2893541 "2024-03-14T18:13:00Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![hogan029uga7](https://avatars.discourse-cdn.com/v4/letter/h/73ab20/32.png) [@hogan029uga7](https://community.thunkable.com/u/hogan029uga7)
#### Post date: [March 14, 2024, 6:13pm UTC](https://community.thunkable.com/t/button-to-copy-text-to-clipboard/2893541/1 "2024-03-14T18:13:00Z")

</div>

Morning All!

I am developing an application for managing templates for notetaking. To be more specific, I have a list of text templates which I need to copy to the Android clipboard which then I can paste into another application. I want to be able to push a single button in order to copy the text to clipboard. I see there was some discussions previous on this but I dont see anything recent with a solution.

---

<div class="post-metadata">

### Author: ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)
#### Post date: [March 15, 2024, 1:55pm UTC](https://community.thunkable.com/t/button-to-copy-text-to-clipboard/2893541/2 "2024-03-15T13:55:08Z")

</div>

Hi @hogan029uga7, thanks for reaching out.

This would not be possible between two different apps–your OS already has the built-in copy and paste capabilities.

You could mimic this action in your Thunkable app by creating a temporary variable when the user “copies” the text and then set a text label to the variable to mimic “pasting” the text if you wanted to just do this in your app.

---

<div class="post-metadata">

### Author: ![hogan029uga7](https://avatars.discourse-cdn.com/v4/letter/h/73ab20/32.png) [@hogan029uga7](https://community.thunkable.com/u/hogan029uga7)
#### Post date: [March 18, 2024, 5:25pm UTC](https://community.thunkable.com/t/button-to-copy-text-to-clipboard/2893541/3 "2024-03-18T17:25:14Z")

</div>

> [@matt\_conroy](#):
>
> and then set a text label to the variable to mimic “pasting” the text if you wanted to

Thanks for your reply!  
The issue is that I want to cut and paste these templates into the Microsoft OneNote Android application. I am using a “Label” field to display the information. I cannot however even use the manual android copy and paste… any ideas why that is happening or if im missing something?

---

<div class="post-metadata">

### Author: ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)
#### Post date: [March 18, 2024, 7:03pm UTC](https://community.thunkable.com/t/button-to-copy-text-to-clipboard/2893541/4 "2024-03-18T19:03:28Z")

</div>

Just the way the labels are set up, text cannot be copied or pasted from or into them. You could try using a text input and set it to not editable. You can hopefully copy and paste into that component.

 ![Screenshot 2024-03-18 at 3.02.46 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/d/6d8153571498283a8d1fe857582eda88339f77d5.png)

---

<div class="post-metadata">

### Author: ![ebisa777783or](https://avatars.discourse-cdn.com/v4/letter/e/3ec8ea/32.png) [@ebisa777783or](https://community.thunkable.com/u/ebisa777783or)
#### Post date: [March 27, 2024, 8:01am UTC](https://community.thunkable.com/t/button-to-copy-text-to-clipboard/2893541/5 "2024-03-27T08:01:13Z")

</div>

Or you can use html code like this

```auto

<!DOCTYPE html>
<html>
<body>
<script>
var my_fav_food = "My fav food is pizza";
</script>

<button onclick="copying_function(my_fav_food)">My Fav Food</button>

<script>
function pasting_function(string) {
 // string.select();
  const el = document.createElement('textarea');
  el.value = string;
  document.body.appendChild(el);
  el.select();
  document.execCommand('copy');
  console.log("copyed!");
    document.body.removeChild(el);

</script>

</body>
</html>

```

Just replace this code as you want or ask chat gpt to change it as you want. If you want to add this to your app make your own website and let the website opent the html and let you website view with web viewer

And the result will be like this

My Fav Food

---

<div class="post-metadata">

### Author: ![ebisa777783or](https://avatars.discourse-cdn.com/v4/letter/e/3ec8ea/32.png) [@ebisa777783or](https://community.thunkable.com/u/ebisa777783or)
#### Post date: [March 31, 2024, 6:05am UTC](https://community.thunkable.com/t/button-to-copy-text-to-clipboard/2893541/6 "2024-03-31T06:05:48Z")

</div>

Ok. But what kind of block?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)
#### Post date: [June 29, 2024, 6:06am UTC](https://community.thunkable.com/t/button-to-copy-text-to-clipboard/2893541/7 "2024-06-29T06:06:29Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
