我有TextField一个helperText. 我想让helperText跨度多行。为此,我需要某种换行符。Material-UI 渲染<p>{ helperText }</p>。由于在 html 中,段落中的换行符是由<br/>我尝试将其添加到我的文本中的。然而,这只是将其添加<br/>到文本中。我还尝试定义helperText组件的外部,一次使用 the <br/>,一次使用\n。但这也不起作用。
如何正确添加换行符helperText?
我的代码示例:
<TextField
name={"help message"}
value={data_field.helper_text}
onChange={(event) => handleDataChange("helper_text", event.target.value)}
helperText={"The value will be shown be shown below the field, just like this text is.<br> This <br/> text should go in the second line."}
/>
Run Code Online (Sandbox Code Playgroud)
结果示例: