Tabs
Tabs
¶
Bases: Widget
A row of tabs.
BINDINGS: ClassVar[list[BindingType]]
class-attribute
¶
Key(s) | Description |
---|---|
left | Move to the previous tab. |
right | Move to the next tab. |
active: reactive[str]
class-attribute
¶
The ID of the active tab, or empty string if none are active.
active_tab: Tab | None
property
¶
The currently active tab, or None if there are no active tabs.
tab_count: int
property
¶
Total number of tabs.
Cleared
¶
TabActivated
¶
__init__(*tabs, active=None, name=None, id=None, classes=None, disabled=False)
¶
Construct a Tabs widget.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*tabs |
Tab | TextType
|
Positional argument should be explicit Tab objects, or a str or Text. |
()
|
active |
str | None
|
ID of the tab which should be active on start. |
None
|
name |
str | None
|
Optional name for the input widget. |
None
|
id |
str | None
|
Optional ID for the widget. |
None
|
classes |
str | None
|
Optional initial classes for the widget. |
None
|
disabled |
bool
|
Whether the input is disabled or not. |
False
|
action_next_tab()
¶
Make the next tab active.
action_previous_tab()
¶
Make the previous tab active.
add_tab(tab)
¶
clear()
¶
Clear all the tabs.
on_mount()
¶
Make the first tab active.
remove_tab(tab_or_id)
¶
Remove a tab.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tab_id |
The Tab's id. |
required |
validate_active(active)
¶
Check id assigned to active attribute is a valid tab.
watch_active(previously_active, active)
¶
Handle a change to the active tab.