Tab button to indent on TextArea component?

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

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

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

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

	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.