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

In [1]:
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 :

In [2]:
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:

In [3]:
text = (
    "This is a **{alert_type}** alert with [an example link]"
    "( 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:

In [4]:
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")

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