Collapse
Last updated
Last updated
In this tutorial you will learn how to use Collapse
widget in Supervisely app.
Parameters | Type | Description |
---|---|---|
Determine Collapse
titles.
type: List[str]
Determine Collapse
content.
type: List[Union[str, Widget]]
Activate accordion mode. If true, only one panel could be active.
type: bool
default value: False
ID of the widget.
type: str
default value: None
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Collapse
content and widgetIf no elements are passed during initialization, then the Collapse will contain an empty element by default. To add new elements and delete the default one use set_items
funciton.
This text widget will show the collapse widget's current active item(s).
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 an app object with layout parameter.
collapse.value_changed
decorator handle collapse changes and pass active collapse items to show_active_item
function.
tbl.click
decorator handle table changes (sorting, searching etc.).
button.click
decorator handle clicks on button. We use this button to open random collapse.
Attributes and Methods | Description |
---|---|
labels
List[str]
Collapses titles. Only distinct values are allowed.
contents
List[Union[str, Widget]]
Collapses content. Raw text or other widgets are possible.
accordion
bool
Whether to activate accordion mode. If true, only one panel could be active.
widget_id
str
Id of the widget
set_active_panel(value: Union[str, List[str]])
Set Collapse
active panel. In accordion mode, only strings are permitted.
get_active_panel()
Return name/names of active panel(s).
get_items()
Return panels description.
set_items(value: List[Collapse.Item])
Set Collapse
items.
add_items(value: List[Collapse.Item])
Extends list of Collapse
items.