Select
Introduction
Select
widget in Supervisely is a graphical user interface element that allows users to choose an option from a predefined list. It presents the options as a dropdown menu that can be expanded and collapsed by clicking. Select
widget has event handler that is triggered when the user selects an option from the dropdown menu. This can be useful for applications that require users to take an action based on the selected option, such as filtering content or displaying specific information.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| List of |
|
| List of |
|
| Whether |
|
| Placeholder |
|
| Size of input |
|
| Whether multiple-select is activated |
|
| ID of the widget |
items
Determine list of Select.Item
widgets.
type: List[Select.Item]
default value: None
Prepare select items:
Initialize widget with given items:
groups
Determine list of Select.Group
widgets.
type: List[Select.Group]
default value: None
Prepare select items and groups:
Initialize widget with given groups of items:
filterable
Whether Select
is filterable.
type: bool
default value: false
placeholder
Placeholder. It needs to set multiple=True
parameter.
type: str
default value: select
size
Size of input.
type: Literal["large", "small", "mini", None]
default value: None
multiple
Whether multiple-select is activated.
type: bool
default value: false
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Return selected item value. |
| Return list of items from widget. |
| Return selected item label. |
| Return list of labels for all items |
| Set |
| Set |
| Disable item by index. |
| Enable item by index. |
| Disable group by index. |
| Enable group by index. |
| Decorator functions is handled when input value is changed. |
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/selection/001_select/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Prepare items and groups of items for Select
widget using Select.Item
and Select.Group
Select
widget using Select.Item
and Select.Group
Initialize Select
widget
Select
widgetCreate 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.
Last updated