TabGroup¶
pywry.toolbar.TabGroup
¶
Bases: ToolbarItem
A group of tabs for single-value selection with tab-style appearance.
Similar to RadioGroup but styled as tabs. Useful for view switching, mode selection, or any mutually exclusive option set that benefits from a tab-like visual appearance.
Emits {componentId: ..., value: ...} on tab change.
| ATTRIBUTE | DESCRIPTION |
|---|---|
options |
List of Option objects (label + value).
TYPE:
|
selected |
Currently selected value.
TYPE:
|
size |
Tab size - "sm", "md" (default), or "lg".
TYPE:
|
Examples:
>>> TabGroup(
... label="View:",
... event="view:change",
... options=[
... Option(label="Table", value="table"),
... Option(label="Chart", value="chart"),
... Option(label="Map", value="map"),
... ],
... selected="table",
... )
Functions¶
normalize_options
classmethod
¶
normalize_options(v: Any) -> list[Option]
Accept list of dicts or Option objects.
auto_generate_component_id
¶
auto_generate_component_id() -> ToolbarItem
Auto-generate component_id based on type if not provided.
validate_event_name
classmethod
¶
Validate event follows namespace:event-name pattern.