Alert#
Open this notebook in Jupyterlite | Download this notebook from GitHub (right-click to download).
import panel as pn
pn.extension()
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.
Parameters:#
For details on other options for customizing the component see the layout and styling how-to guides.
object
(str): The contextual feedback message.alert_type
(str): The type of Alert and one ofprimary
,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.Column(*[
pn.pane.Alert(text.format(alert_type=at), alert_type=at)
for at in pn.pane.Alert.param.alert_type.objects],
sizing_mode="stretch_width"
).servable()
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.
<hr>
Did you notice the use of the divider?
"""
pn.pane.Alert(text, alert_type="success")
Open this notebook in Jupyterlite | Download this notebook from GitHub (right-click to download).