On this page


Download this notebook from GitHub (right-click to download).

import panel as pn

The Alert pane allows providing contextual feedback messages for typical user actions with the handful of available and flexible alert messages.

It’s heavily inspired by the Bootstrap Alert.


For layout and styling related parameters see the customization user guide.

  • object (str): The contextual feedback message.

  • alert_type (str): The type of Alert and one of primary, secondary, success, danger, warning, info, light, dark.

The Alert pane supports Markdown and HTML syntax :

pn.pane.Alert('## Alert\nThis is a warning!')

The Alert pane also a number of alert_type options which control the color of the alert message:

text = (
    "This is a **{alert_type}** alert with [an example link]"
    "(https://panel.holoviz.org/). Give it a click if you like."

    pn.pane.Alert(text.format(alert_type=at), alert_type=at)
    for at in pn.pane.Alert.param.alert_type.objects],

It may also be used for longer messages:

text = """
### Well done!

Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.


Did you notice the use of the divider?
pn.pane.Alert(text, alert_type="success")
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.

Download this notebook from GitHub (right-click to download).