Button¶
pywry.toolbar.Button
¶
Bases: ToolbarItem
A clickable button that emits an event with optional data payload.
| ATTRIBUTE | DESCRIPTION |
|---|---|
variant |
Button style variant. Options: "primary" (theme-aware), "secondary" (subtle), "neutral" (blue), "ghost" (transparent), "outline" (bordered), "danger" (red), "warning" (orange), "icon" (ghost style, square aspect ratio).
TYPE:
|
size |
Button size variant. Options: None (default), "xs", "sm", "lg", "xl".
TYPE:
|
data |
Additional data payload to include with the event.
TYPE:
|
Examples:
>>> Button(label="Export", event="export:csv", data={"format": "csv"})
>>> Button(label="Cancel", event="app:cancel", variant="secondary")
>>> Button(label="⚙", event="app:settings", variant="icon")
>>> Button(label="Submit", event="form:submit", variant="neutral", size="lg")
Functions¶
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.