# Tab button to indent on TextArea component?

**URL:** <https://forum.inductiveautomation.com/t/tab-button-to-indent-on-textarea-component/60385>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [June 5, 2022, 9:46pm UTC](https://forum.inductiveautomation.com/t/tab-button-to-indent-on-textarea-component/60385 "2022-06-05T21:46:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![csilk](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@csilk](https://forum.inductiveautomation.com/u/csilk)\
**Post date:** [June 5, 2022, 9:46pm UTC](https://forum.inductiveautomation.com/t/tab-button-to-indent-on-textarea-component/60385/1 "2022-06-05T21:46:54Z")

</div>

I am wondering if there is a way to allow for user to hit the tab button, on their keyboard, and have a text area indent like it would on a word document?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 6, 2022, 3:12pm UTC](https://forum.inductiveautomation.com/t/tab-button-to-indent-on-textarea-component/60385/2 "2022-06-06T15:12:15Z")

</div>

I don’t think so, no (at least with the way Perspective currently works).

You would have to _conditionally_ prevent the default behavior of the tab key, which requires executing Javascript, e.g. this SO thread: [javascript - Use tab to indent in textarea - Stack Overflow](https://stackoverflow.com/questions/6637341/use-tab-to-indent-in-textarea)

We allow you to prevent the default behavior, but only as a static configuration for a given action.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 6, 2022, 3:37pm UTC](https://forum.inductiveautomation.com/t/tab-button-to-indent-on-textarea-component/60385/3 "2022-06-06T15:37:44Z")

</div>

Since _Tab_ is used to advance between HTML elements you should consider using _Ctrl-Tab_ for inserting tabs in the _Text Area_ component. This has plenty of precedent including creating tabs inside MS Word table cells and users would get used to it fairly quickly. (You can include the instruction in the placeholder text.)

If you right-click the TextArea component in the Project Browser, Configure Events, onKeyDown, +, Script and add the code

```auto
	system.perspective.print(event.key)
	system.perspective.print(event.ctrlKey)

```

you’ll be able to see the results if you open the console (Tools | Console).

Unfortunately I wasn’t able to figure out how to get the script to insert the _Tab_ character into the field. I don’t even know if it would render it if there was one.
