RadioGroup¶
pywry.toolbar.RadioGroup
¶
Bases: ToolbarItem
A group of radio buttons for single selection.
Emits {value: ...} on selection change.
| ATTRIBUTE | DESCRIPTION |
|---|---|
options |
List of Option objects for the radio group.
TYPE:
|
selected |
Currently selected value.
TYPE:
|
direction |
Layout direction - "horizontal" or "vertical".
TYPE:
|
Examples:
>>> RadioGroup(
... label="View:",
... event="view:change",
... options=[
... Option(label="List", value="list"),
... Option(label="Grid", value="grid"),
... ],
... selected="list",
... direction="horizontal",
... )
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.