SurfaceNode is one piece of the tree:
kind: container orleaflayout: LayoutSpeccontent: what to draw (leaf only)children: child nodes (containers)id: SurfaceIdhit/hit_data: pointer routingsemantics: optional accessibility metadatafocus_scope: keep keyboard focus inside this subtree
hit (or use a constructor that sets it) on anything you want to click.
Constructors vs manual nodes
Many controls have helpers onSurfaceNode:
section, tabs, form_row, color_swatch, and gradient_swatch, build the struct manually:
Structural leaves
panel (PanelSpec)
Rounded card background with optional border and shadow.
rect (RectStyle)
Flat filled or bordered rectangle. Use for dividers, highlights, custom backgrounds.
spacer (container kind)
Empty node. Size comes from LayoutSpec (often .fill to push siblings).
Text and actions
label (LabelSpec)
No hit region. Not focusable.
button (ButtonSpec)
Constructor sets
hit = .button.
icon_button (IconButtonSpec)
hit = .icon_button.
Text input
text_input (TextInputSpec)
hit = .text_input. Pair with ui.InputBuffer(N) in app state and Wayland text-input protocol for IME.
Boolean and numeric controls
checkbox (CheckboxSpec)
hit = .checkbox.
toggle (ToggleSpec)
hit = .toggle.
slider (SliderSpec)
hit = .slider. Default layout width is .fill.
number_input (NumberInputSpec)
Stepper with decrement/value/increment zones.
hit = .number_value on the center field. Decrement/increment buttons use separate hit kinds (.number_decrement, .number_increment) when emitted.
progress (ProgressSpec)
Read-only bar.
No hit region.
Selection and color
select (SelectSpec)
Dropdown trigger or inline popup.
hit = .select. Option rows use .select_option in overlay pass.
color_picker (ColorPickerSpec)
Inline SV square + hue/alpha bars.
hit = .color_picker_sv on the saturation/value area. Hue and alpha bars have .color_picker_hue and .color_picker_alpha.
color_picker_popup (ColorPickerPopupSpec)
Larger popup variant used by settings. Pass hsv from ui.drawing.HSV.
color_swatch / gradient_swatch
Small preview tiles. Set layout to fixed size. gradient_swatch takes start, mid, end colors.
Navigation chrome
tabs (TabsSpec)
Tab hits use
.tab. Build manually:
section (SectionSpec)
Section header with optional underline.
form_row (FormRowSpec)
Settings-style label + value row.
list_row (ListRowSpec)
Selectable list item with optional icon and subtitle.
Constructor:
listRow(id, spec, hit_data). hit = .button, hit_data carries list index.
scrollbar (ScrollbarSpec)
hit = .scroll. Pair with app scroll offset updates on .scroll dispatch events.
Media
image (ImageSpec)
icon (IconSpec)
Hit kinds reference
Set
hit_data: u64 to pass a list index, enum tag, or pointer cookie to your handler.
Disabled content
ButtonSpec.disabled, ToggleSpec.disabled, SelectSpec.disabled, and similar flags mark the control visually disabled and set HitFlags.enabled = false so hitTest skips them.
Next
- Input and overlays: wire hits to app logic
- Drawing primitives: lower-level helpers behind these emitters

