Content
Message
A component that displays a message in various styles, including success, error, warning, and informational.
When working with operations that can succeed or fail, Message can be useful. You can reserve a state element to be used for the outcome of the operation; empty messages aren’t shown, so you can initialise it empty. Then, assign a message when the operation is completed.
state["msg"] = ""
if is_ok:
state["msg"] = "+It worked!"
else:
state["msg"] = "-It failed"
Fields
Name | Type | Description | Options |
---|---|---|---|
Message | Text | Prefix with ’+’ for a success message, with ’-’ for error, ’!’ for warning, ’%’ for loading. No prefix for info. Leave empty to hide. | |
Success | Color | ||
Error | Color | ||
Warning | Color | ||
Info | Color | ||
Loading | Color | ||
Primary text | Color | ||
Custom CSS classes | Text | CSS classes, separated by spaces. You can define classes in custom stylesheets. |
Low code usage
This component can be declared directly in Python, using backend-driven UI.
ui.Message(content={
"message": "", # str
"successColor": "", # str
"errorColor": "", # str
"warningColor": "", # str
"infoColor": "", # str
"loadingColor": "", # str
"primaryTextColor": "", # str
"cssClasses": "", # str
}
)