How to enable rich text for textarea component UI Builder

rohjamil
Tera Contributor

Anyone have any idea on how to enable rich text for the textarea component in UI Builder? Basically trying to use the textarea component and noticed that it does not allow any rich text formatting

3 REPLIES 3

Kevin83
ServiceNow Employee
ServiceNow Employee

There isn't a rich text editor component available to use directly in UI Builder. You could use it indirectly through a form though if this a field on a table as form supports the HTML field type.

rohjamil
Tera Contributor

This is not a field on a table. Using this field as a input for a subflow. So I don't think form would work in this case

Kevin83
ServiceNow Employee
ServiceNow Employee

An option you can use to access the editor is to manually configure the form.

here I set the sections prop to:

[{"sysId":"0d7f576783591210d99edf647daad349","caption":"testing","captionDisplay":"Testing","rows":[[{"fields":["html"]}]],"id":0,"label":"Testing","defaultSection":false,"expanded":true,"deferHeadingAndIcon":true}]

and the fields prop to:

{"html":{"autofocus":true,"dependentField":null,"dependentTable":null,"dictionary":{"attributes":[],"canCreate":true,"canRead":true,"canWrite":true,"dependentField":null,"dependentFieldLabel":null,"dependentTable":null,"encryptionContext":"","fieldHint":"","internalType":"html","isEncrypted":false,"isMandatory":false,"label":"HTML","name":"html","sys_readonly":false,"type":"html"},"displayValue":null,"display_value_list":[],"highlightedValue":{},"internalType":"html","isGlideVar":false,"label":"HTML","mandatory":false,"menuConfigs":"","name":"html","originalValue":"","readonly":false,"referenceSysId":"","referringRecordId":"5f09104483251210d99edf647daad371","referringTable":"testing","sys_readonly":false,"type":"html","value":"","valuesList":[],"visible":true}}

Screenshot 2024-10-24 at 12.10.10 PM.png

 
To get to this point I added the form component and deleted the controller and some associated extra components.

I also added a quick script for testing like so:

Screenshot 2024-10-24 at 12.12.28 PM.png

 



When I run the page I can see it work like so:

Screenshot 2024-10-24 at 12.11.42 PM.png