Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Line break in Alert dbc component

Hello dear Dash friends,
I am trying to display an alert using Alert dash bootstrap component.
The alert is shown but I didn’t find so far how to include line breaks. I tried with \n and then with html.Br() (cf code below), none of them worked.
How to do this?

 dbc.Alert('''
                                text here''' html.Br()
                                '''text here''' html.Br()
                                ''' text here''' html.Br()
                                '''text here
                                ''', color="danger")

Hi,

dbc.Alert accepts html components as children, so you could do for example:

dbc.Alert(
    [
        "Some text",
        html.Br(),
        "More text",
        html.P("Some other text in a <p>"),
    ],
   color="danger"
)
1 Like

Thank you! it works perfectly