0

I am trying to create a multiple line webpart property using this code: PropertyPaneTextField('test', { label: 'Multi-line Text Field', multiline: true }),

As described in the docs, however, when i type multiple lines in the field, they're just displayed as one line only in the UI. Is there a way to let the user type what they want, and the result is displayed as is in the UI?

2 Answers 2

2

You can try escaping the property value and then replacing %0A with <br/>. Like this
let propVal:string = escape(this.properties.test).replace(/%0A/g,"<br/>")

1

when you use multiline: true property, it enables you to enter the number of rows you want to display via the property rows?: number. This will help you display text field as text area.

PropertyPaneTextField('test', {
                  label: 'Multi-line Text Field',
                  multiline: true,
                  rows: 5
                }),
1
  • I just tried it, it doesn't have any effect. This is my code: ` PropertyPaneTextField('test', { label: 'Multi-line Text Field', multiline: true, rows: 5 }), ` Still the output it displayed as one row, and it wraps when the div reaches the end, but I want the the text to be displayed the same way the user types it in the property.
    – B1B
    May 13, 2018 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.