---
title: Menus
url: "https://native-sdk.dev/docs/menus"
docs_index: /llms.txt
lastUpdated: 2026-10-16
---

> For an index of all documentation, see [/llms.txt](/llms.txt).

The Native SDK can configure native app menus from the app manifest or typed Zig data. Menu items dispatch through the same command path as shortcuts, native controls, tray actions, and bridge commands.

```zig
.menus = .{
    .{
        .title = "View",
        .items = .{
            .{ .label = "Refresh", .command = "app.refresh", .key = "r", .modifiers = .{ "primary" } },
            .{ .separator = true },
        },
    },
},
```

Generated zero-config runners load manifest menus automatically for both TypeScript cores and Zig cores. Ejected runners use the same fallback. Pass a non-null `menus` slice to `runWithOptions` when lower-level Zig wiring needs to override the manifest at runtime (an explicit empty slice disables manifest menus):

```zig
const view_items = [_]native_sdk.MenuItem{
    .{
        .label = "Refresh",
        .command = "app.refresh",
        .key = "r",
        .modifiers = .{ .primary = true },
    },
};

const menus = [_]native_sdk.Menu{
    .{ .title = "View", .items = &view_items },
};

try runner.runWithOptions(app.app(), .{
    .app_name = "native-shell",
    .bundle_id = "dev.native_sdk.native_shell",
    .menus = &menus,
}, init);
```

When a user selects a command-backed menu item, the runtime emits `Event.command` with `source = .menu`, the active native `window_id`, and the item command name.

The macOS, Linux, and Windows system-WebView backends apply configured menus as native app/window menus. Backends that do not implement native menus return `UnsupportedService` for non-empty menu lists.

## Context menus

Per-widget right-click menus are declared once and presented by the platform: the real OS menu opens at the pointer on all three desktops (`NSMenu` on macOS, `TrackPopupMenu` on Windows, `GtkPopoverMenu` on Linux); hosts without a native menu presenter (the mobile toolkit hosts and embed hosts today) mount the same declared items as an anchored canvas surface at the click point automatically. Markup declares them as a `<context-menu>` child of the pressable element; Zig views use `ElementOptions.context_menu`. Selections dispatch typed Msgs — see [Native UI](/docs/native-ui#native-scrolling-and-context-menus) for the authoring shapes and [Automation](/docs/automation) for driving them in tests (`widget-context-menu`).

---

For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md)

For an index of all available documentation, see [/llms.txt](/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/agents.md](/agents.md)