alert(message: str, level: str = "info", size: float = 1.0) -> str

The alert function adds an alert notification to your app.

Parameters

  • message (str): The message displayed by the alert
  • level (str): The severity level of the alert. Valid values are: “info”, “success”, “warning”, “error”, “critical”
  • size (float): (Optional) The width of the component in a row. Defaults to 1.0 (full row). See the Layout Guide for details.

Returns

  • str of the provided message

Usage Example

Here’s an example of how to add an alert to your app:

from preswald import alert

alert(message="This is an alert!", level="critical")

Key Features

  1. Customizable Message: Set the specific message of the alert.
  2. Adjustable Severity: Control the urgency by setting level to different severity levels.

Why Use alert?

Alerts provide a way to render updates/notifications to the user with more urgency and different severity levels to convey importance.

Was this page helpful?