Button
Use button to dispatch a message when pressed. The element content supplies the label, on-press names the message, and icon adds a built-in vector icon to the same hit target. Set variant to choose the color and border treatment.

Markup
Sizes
The supported sizes are sm, default, lg, and icon. Use icon for a square button and set label to provide its accessible name.

Icons
icon names a built-in vector icon. The icon shares the button’s hit target and disabled state. For an icon-only button, use size="icon", omit the content, and set label.

States
Hover and press styling is engine-owned render state; disabled is a source attribute (a literal or a model binding).

Button Group
Use button-group to attach related action buttons with shared borders.
Programmatic construction (Zig)
In a Zig view, the canvas.Ui builder constructs the same tree programmatically:
Attributes
| Attribute | Description |
|---|---|
text | Text value for text-bearing elements; a literal or one {binding}. |
variant | Visual variant: default|primary|secondary|outline|ghost|destructive. |
size | Control size: default|sm|lg|icon. On text, also the typography rungs heading|display (themable token steps above title - a section heading, a hero stat); numeric sizes are not accepted - retheme the typography tokens instead. |
icon | button, toggle-button, list-item, menu-item: vector icon drawn inline (buttons/toggle-buttons before the label, list/menu items as a leading slot): a built-in name (comptime-validated against canvas.icons.known_icon_names, e.g. save, plus, refresh-cw), an app-registered app:<name>, or one {binding} resolving to such a name. Icon-only buttons when the content is empty — add a label. One hit target, one enabled/disabled tint. |
disabled | Disables the control; true/false or a {binding}. |
selected | Selected state; often a {a == b} equality. |
autofocus | Focusable controls only: moves keyboard focus to the element when it mounts or when the value turns on (edge-triggered - holding it true never re-steals focus). The TEA way to focus an editor on create. |
label | Accessible name; when set it REPLACES the element's text as the announced name - screen readers and automation snapshots see the label, never the text it shadows. |
on-press | Dispatch a Msg on press: tag or tag:{payload}. Legal on any element — a bound press handler makes it pressable, and presses on plain text/icons inside it fall through to it (dragging still selects text). |
on-hold | Press-and-hold Msg: a pointer held ~350 ms dispatches it and the release then presses nothing; a quick click dispatches on-press as usual. A right/ctrl-click with no context menu on the route dispatches it immediately. Like on-press, binding it makes any element pressable. |



