Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-line antd alert description

Tags:

antd

Is there a way to have a multi-line alert description that also includes HTML (ie <code> tags)

It seems that the description is escaped, so any markup or \n is rendered literally, eg https://codepen.io/anon/pen/awzNzP?editors=001.

like image 263
Glenn Slaven Avatar asked Jun 05 '17 06:06

Glenn Slaven


1 Answers

Ok, I figured it out. I failed to notice that the description property can be a ReactNode, so you can do this

descriptionElement = (
  <code>
    Line 1
    <br />
    Line 2
  </code>
)
<Alert message='test' type='info' description={descriptionElement} />

Running version

like image 184
Glenn Slaven Avatar answered Nov 02 '22 14:11

Glenn Slaven