Badge
Introduction
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.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| Badge widget content value |
|
| Determine a widget to content in badge |
|
| Determine max value of badge content. Value type has to be a number |
|
| Specifies that badge is displayed as a dot |
|
| Specifies that a badge widget is hidden |
|
| ID of the widget |
value
Badge widget content value
type: Union[int, str, float]
default value: None
widget
Determine a widget to content in badge
type: Optional[Widget]
default value: None
max
Determine max value of badge content. Value type has to be a number
type: int
default value: None
is_dot
Specifies that badge is displayed as a dot
type: bool
default value: False
hidden
Specifies that a badge widget is hidden
type: bool
default value: False
widget_id
ID of the widget
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Set badge value |
| Get badge value |
| Clear badge value |
| Hide badge on widget |
| Show badge on widget |
| Toggle visibility of badge on widget |
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/status-elements/006_badge/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Prepare Button
, Checkbox
, Input
, InputNumber
widgets to contain in Badge
widgets
Button
, Checkbox
, Input
, InputNumber
widgets to contain in Badge
widgetsCreate Badge
widgets we will use in UI for demo
Badge
widgets we will use in UI for demoCreate app layout
Prepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create app using layout
Create an app object with layout parameter.
Add functions to control widgets from code
Last updated