Badge
Last updated
Last updated
Badge
widget in Supervisely is a versatile tool for displaying notifications or counts on elements such as buttons, text. With customizable types (number, text, or dot), visibility, the Badge can be easily used in Supervisely apps for a seamless user experience.
Badge widget content value
type: Union[int, str, float]
default value: None
Determine a widget to content in badge
type: Optional[Widget]
default value: None
Determine max value of badge content. Value type has to be a number
type: int
default value: None
Specifies that badge is displayed as a dot
type: bool
default value: False
Specifies that a badge widget is hidden
type: bool
default value: False
ID of the widget
type: str
default value: None
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/status-elements/006_badge/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Button
, Checkbox
, Input
, InputNumber
widgets to contain in Badge
widgetsBadge
widgets we will use in UI for demoPrepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create an app object with layout parameter.
Parameters | Type | Description |
---|---|---|
Attributes and Methods | Description |
---|---|
value
Union[int, str, float]
Badge widget content value
widget
Optional[Widget]
Determine a widget to content in badge
max
int
Determine max value of badge content. Value type has to be a number
is_dot
bool
Specifies that badge is displayed as a dot
hidden
bool
Specifies that a badge widget is hidden
widget_id
str
ID of the widget
set_value(value: Union[str, int, float])
Set badge value
get_value()
Get badge value
clear()
Clear badge value
hide_badge()
Hide badge on widget
show_badge()
Show badge on widget
toggle_visibility()
Toggle visibility of badge on widget