expandable
Displays its child elements in a collapsible area.
Expandable is a block control.
Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
(★) |
strdynamic |
Title of the expandable block. |
|
expanded |
booldynamic |
True | If True, the block is expanded, and the content is displayed. |
page |
str |
The page name to show as the content of the block. |
|
partial |
taipy.gui.Partial |
A Partial object that holds the content of the block. |
|
id |
str |
The identifier assigned to the rendered HTML component. |
|
properties |
dict[str, Any] |
A dictionary of additional properties that can be set to the element. |
|
class_name |
strdynamic |
A space-separated list of CSS class names to be applied to the generated HTML element. |
|
hover_text |
strdynamic |
The text that is displayed when the user hovers over the element. |
|
on_change |
Union[str, Callable] |
A function or the name of a function that is triggered when the value changes.
|
(★)title is the default property for this visual element.
Usage¶
Defining a title and managing expanded state¶
The default property title defines the title shown when the visual element is collapsed.
Definition
<|Title|expandable|expand={expand}|>
<taipy:expandable expand="{expand}">Title</taipy:expandable>
import taipy.gui.builder as tgb
...
tgb.expandable("Title", expand="{expand}")
Content as block¶
The content of expandable can be specified as the block content.
Definition
<|Title|expandable|
...
<|{some_content}|>
...
|>
<taipy:expandable title="Title">
...
<taipy:text>{some_content}</taipy:text>
...
</taipy:expandable>
import taipy.gui.builder as tgb
...
with tgb.expandable("Title")
tgb.text("{some_content}")
Expandable with page¶
The content of the expandable can be specified as an existing page name using the page property.
Definition
<|Title|expandable|page=page_name|>
<taipy:expandable page="page_name">Title</taipy:expandable>
import taipy.gui.builder as tgb
...
tgb.expandable("Title", page="page_name")
Expandable with partial¶
The content of the expandable can be specified as a Partial instance using the
partial property.
Definition
<|Title|expandable|partial={partial}|>
<taipy:expandable partial="{partial}">Title</taipy:expandable>
import taipy.gui.builder as tgb
...
tgb.expandable("Title", partial="{partial}")
Styling¶
All the expandable blocks are generated with the "taipy-expandable" CSS class. You can use this class name to select the expandable blocks on your page and apply style.