InputTagList widget in Supervisely is a user interface element that allows users to work with multiple tag labels simultaneously. Unlike the single InputTag widget, InputTagList enables bulk operations on tag collections, making it easier to manage multiple tags at once. It uses a list of TagMeta objects and provides convenient methods for selecting, deselecting, and manipulating multiple tags. This widget is particularly useful for applications that need to handle multiple tag operations efficiently.
Function signature
Copy InputTagList (
tag_metas ,
max_width = 300 ,
max_height = 50 ,
multiple = False ,
widget_id = None ,
) Parameters
Type
Description
Union[List[TagMeta], TagMetaCollection]
List of TagMeta objects from which Tags will be managed
If set False, only one tag can be selected at a time, otherwise can select several tags (multi-select).
Determine list of TagMeta objects from which Tags will be managed. Supports all possible Tag types: any_number, any_string, one_of_string, none.
type: Union[List[TagMeta], TagMetaCollection]
Determine max tag field width.
type: int
default value: 300
Determine max tag field height.
type: int
default value: 50
If set False, only one tag can be selected at a time, otherwise can select several tags (multi-select).
type: bool
default value: False
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods
Description
Select all available tags in the list.
Deselect all tags in the list.
select(tag_names: List[str])
Select specific tags by their names.
Get list of currently selected tags with their values.
Get list of TagMeta objects for currently selected tags.
set_values(values: Dict[str, Any])
Set values for tags by tag name.
Decorator function is handled when tag selection is changed.
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/misc/input_tag_list/src/main.pyarrow-up-right
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize control buttons and text widget
Create app layout
Prepare a layout for app using Card widget with the content parameter and place widgets in containers.
Create app using layout
Create an app object with layout parameter.
Use decorators to handle button clicks and tag selection changes:
Last updated 5 months ago