Native Controls

Native controls are platform-owned views declared with App.scene_fn, attached with runtime.createShellViews(...), created imperatively through runtime.createView(...), or created from trusted WebView code through the guarded window.zero.views.* bridge helpers. They are intended for trusted chrome, utility panels, and OS-native affordances around rich WebView content.

const shell_views = [_]zero_native.ShellView{
    .{ .label = "toolbar", .kind = .toolbar, .edge = .top, .height = 52 },
    .{ .label = "refresh-icon", .kind = .icon_button, .parent = "toolbar", .accessibility_label = "Refresh", .text = "R", .command = "app.refresh" },
    .{ .label = "refresh", .kind = .button, .parent = "toolbar", .text = "Refresh", .command = "app.refresh" },
    .{ .label = "search", .kind = .search_field, .parent = "toolbar", .text = "Search" },
    .{ .label = "live", .kind = .checkbox, .parent = "toolbar", .text = "Live" },
    .{ .label = "view-mode", .kind = .segmented_control, .parent = "toolbar", .text = "List|Grid" },
    .{ .label = "syncing", .kind = .progress_indicator, .parent = "toolbar", .role = "Syncing" },
    .{ .label = "body", .kind = .split, .fill = true, .axis = .row },
    .{ .label = "sidebar", .kind = .sidebar, .parent = "body", .width = 240 },
    .{ .label = "filters", .kind = .stack, .parent = "sidebar", .x = 16, .y = 16, .width = 180, .height = 120, .axis = .column },
    .{ .label = "filter-title", .kind = .label, .parent = "filters", .text = "Filters" },
    .{ .label = "filter-live", .kind = .checkbox, .parent = "filters", .text = "Live" },
    .{ .label = "main", .kind = .webview, .parent = "body", .url = "zero://inline", .fill = true },
};

const shell_windows = [_]zero_native.ShellWindow{.{
    .label = "main",
    .title = "Acme",
    .width = 1100,
    .height = 760,
    .views = &shell_views,
}};

fn scene(context: *anyopaque) anyerror!zero_native.ShellConfig {
    _ = context;
    return .{ .windows = &shell_windows };
}

Supported Kinds

KindNotes
toolbarNative container for top app chrome
titlebar_accessoryNative titlebar-adjacent container where the platform allows it
sidebarNative side panel container
statusbarNative bottom/status container
splitNative container for fixed and fill panes; set axis to .row or .column
stackNative container for grouped child controls; set axis to .row or .column
buttonDispatches command through Event.command
icon_buttonCompact command button for toolbar-style actions
checkboxNative checkbox control
toggleNative binary toggle button
segmented_controlNative segmented choice control; use pipe-delimited text, such as List|Grid
text_fieldNative editable text field
search_fieldNative search input
labelNative static text
spacerEmpty native layout spacer
progress_indicatorNative indeterminate progress indicator
webviewCompatibility view backed by the WebView backend

The macOS, Linux, and Windows system-WebView backends support these native kinds today. Chromium hosts return explicit unsupported errors until their native hosts implement the same surface.

Layout

For declarative shell views, use edge for docked chrome, fill = true for content, parent for controls inside containers, axis for row or column child flow, and min/max size fields when a surface needs resize constraints. stack containers apply native spacing between controls; split containers divide panes along their axis without spacing, so a fixed sidebar and fill WebView can resize together. The runtime keeps shell views bound to the window and reapplies their frames on resize.

Use accessibility_label for the announced control name when it should differ from visible text. Use role for semantic/fallback accessibility text. Use text for visible labels, button titles, and text/search placeholders.

ViewInfo.focused reports the last successfully focused view in a window. Use runtime.focusNextView(...), runtime.focusPreviousView(...), or window.zero.views.focusNext() / focusPrevious() to move through visible, enabled native controls and WebView-backed views in stable view order. Automation snapshots include the same focus state for native controls and WebView-backed views.