# Define button label from entered text from text area

**URL:** <http://forum.squareline.io/t/define-button-label-from-entered-text-from-text-area/1865>\
**Category:** How to\
**Created:** [September 27, 2023, 11:25pm UTC](http://forum.squareline.io/t/define-button-label-from-entered-text-from-text-area/1865 "2023-09-27T23:25:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chevymn1964](http://forum.squareline.io/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@chevymn1964](http://forum.squareline.io/u/chevymn1964)\
**Post date:** [September 27, 2023, 11:25pm UTC](http://forum.squareline.io/t/define-button-label-from-entered-text-from-text-area/1865/1 "2023-09-27T23:25:46Z")

</div>

### What do you want to achieve?

Make a button where user can change the label text in order to customize it…

### What have you tried so far?

Use a text area and make it clickable, detect when clicked then keyboard changes state from hidden then enter text that way but cannot figure out how to “move” that text over to the button label. I know it can be done in code but it would be nice to make it work in Squareline…

### Screenshot or video

### Others

- \*\*SquareLine Studio version: Latest
- **Operating system:**
- \*\*Target hardware: ESP32

---

<div class="post-metadata">

**Author:** ![CodeGrue](http://forum.squareline.io/letter_avatar_proxy/v4/letter/c/4491bb/32.png) [@CodeGrue](http://forum.squareline.io/u/CodeGrue)\
**Post date:** [February 28, 2024, 2:45pm UTC](http://forum.squareline.io/t/define-button-label-from-entered-text-from-text-area/1865/2 "2024-02-28T14:45:44Z")

</div>

You need to add a change event on the textarea that calls a custom function. That function would copy the value of the textarea to the label.

---

<div class="post-metadata">

**Author:** ![Hermit](http://forum.squareline.io/user_avatar/forum.squareline.io/hermit/32/971_2.png) [@Hermit](http://forum.squareline.io/u/Hermit)\
**Post date:** [March 1, 2024, 6:05pm UTC](http://forum.squareline.io/t/define-button-label-from-entered-text-from-text-area/1865/3 "2024-03-01T18:05:28Z")

</div>

You can’t do that exact task directly in SquareLine Studio currently, but manually in the exported code like CodeGrue says, with a CALL\_FUNCTION event on the READY trigger of the used keyboard-widget. (If you set ‘Don’t export’ for the event, the function can (and must) be in your own code, otherwise you’ll find the function in ui\_events.c, where you can get the text of the edited textfield with lv\_textarea\_get\_text() and copy it to the button-label with lv\_label\_set\_text().)  
(Btw you can set fix text in SquareLine studio by choosing ‘change property’ for ‘label’ event, placing it on a ‘READY’ trigger of your keyboard-widget, which triggers the label-change event on the button. But it seems that’s not what you want.)  
Another option might be to add the textarea directly inside your button-object in the hierarchy, with a styling that fits the button, with clickable flag turned off (so the button’s whole area including the textarea, is clickable), then assigning that textarea inside the button to the keyboard. You can set it on the ‘VALUE\_CHANGED’ trigger of the keyboard to update instantly or on the ‘READY’ trigger to update it by the tick.
