status
Displays a status or a list of statuses.
Properties¶
Name | Type | Default | Description |
---|---|---|---|
(★) |
Union[tuple,dict,list[dict],list[tuple]] |
The different status items to represent. See below. |
|
without_close |
bool |
False | If True, the user cannot remove the status items from the list. |
id |
str |
The identifier that is assigned to the rendered HTML component. |
|
properties |
dict[str, Any] |
Bound to a dictionary that contains additional properties for this element. |
|
class_name |
str dynamic |
The list of CSS class names that are associated with the generated HTML Element. |
|
hover_text |
str dynamic |
The information that is displayed when the user hovers over this element. |
(★)value
is the default property for this visual element.
Details¶
Every status line has a message to be displayed and a status priority.
The status priority is defined by a string among "info" (or "i"), "success" (or "s"), "warning" (or "w"), and
"error" (or "e"). An unknown string value sets the priority to "info".
These priorities are sorted from lower to higher as indicated here.
The property value can be set to a value with the following type:
- A tuple: the status shows a single line; the first element of the tuple defines the status value, and the second element holds the message.
- A dictionary: the status shows a single line; the key "status" of the dictionary holds the status value, and the key "message" holds the message.
- A list of tuples: a list of status entries, each defined as described above.
- A list of dictionaries: a list of status entries, each defined as described above.
When a list of statuses is provided, the status control can be expanded to show all individual status entries. Users can then remove individual statuses if without_close is set to False (which is the default value).
Usage¶
Show a simple status¶
To show a simple status
control, you would define a Python variable:
status = ("error", "An error has occurred.")
This variable can be used as the value of the property value of
the status
control:
Definition
<|{value}|status|>
<taipy:status>{value}</taipy:status>
import taipy.gui.builder as tgb
...
tgb.status("{value}")
The control is displayed as follows:
Note that the variable status could have been defined as a dictionary to achieve the same result:
status = {
"status": "error",
"message": "An error has occurred."
}
Show a list of statuses¶
The status
control can show several status items. They are initially collapsed, where the
control shows the number of statuses with a status priority corresponding to the highest priority
in the status list.
You can create a list of status items as a Python variable:
status = [
("warning", "Task is launched."),
("warning", "Taks is waiting."),
("error", "Task timeout."),
("info", "Process was cancelled.")
]
The declaration of the control remains the same:
Definition
<|{value}|status|>
<taipy:status>{value}</taipy:status>
import taipy.gui.builder as tgb
...
tgb.status("{value}")
The control is initially displayed as this:
If the user clicks on the arrow button, the status list is expanded:
The user can remove a status entry by clicking on the cross button. Here, the user has removed the third status entry:
Prevent status dismissal¶
If you don't want the user to be allowed to dismiss the displayed statuses, you can set the without_close property to True:
Definition
<|{value}|status|without_close|>
<taipy:status without_close>{value}</taipy:status>
import taipy.gui.builder as tgb
...
tgb.status("{value}", without_close=True)
With the same array as above, here is what the expanded control looks like:
Styling¶
All the status controls are generated with the "taipy-status" CSS class. You can use this class name to select the status controls on your page and apply style.