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

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

The Native SDK provides native file and message dialogs accessible from Zig via `Runtime.showOpenDialog(...)`, `Runtime.showSaveDialog(...)`, and `Runtime.showMessageDialog(...)`, or from JavaScript via the [builtin bridge](/docs/bridge/builtin-commands).

## Open file dialog

<table>
  <thead>
    <tr>
      <th>
        Field
      </th>

      <th>
        Type
      </th>

      <th>
        Default
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `title`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>

    <tr>
      <td>
        `default_path`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>

    <tr>
      <td>
        `filters`
      </td>

      <td>
        `[]const FileFilter`
      </td>

      <td>
        <code>&.</code>
      </td>
    </tr>

    <tr>
      <td>
        `allow_directories`
      </td>

      <td>
        `bool`
      </td>

      <td>
        `false`
      </td>
    </tr>

    <tr>
      <td>
        `allow_multiple`
      </td>

      <td>
        `bool`
      </td>

      <td>
        `false`
      </td>
    </tr>
  </tbody>
</table>

Returns `OpenDialogResult` with `count` and `paths`.

## Save file dialog

<table>
  <thead>
    <tr>
      <th>
        Field
      </th>

      <th>
        Type
      </th>

      <th>
        Default
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `title`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>

    <tr>
      <td>
        `default_path`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>

    <tr>
      <td>
        `default_name`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>

    <tr>
      <td>
        `filters`
      </td>

      <td>
        `[]const FileFilter`
      </td>

      <td>
        <code>&.</code>
      </td>
    </tr>
  </tbody>
</table>

Returns an optional path string.

## Message dialog

<table>
  <thead>
    <tr>
      <th>
        Field
      </th>

      <th>
        Type
      </th>

      <th>
        Default
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `style`
      </td>

      <td>
        `MessageDialogStyle`
      </td>

      <td>
        `.info`
      </td>
    </tr>

    <tr>
      <td>
        `title`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>

    <tr>
      <td>
        `message`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>

    <tr>
      <td>
        `informative_text`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>

    <tr>
      <td>
        `primary_button`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `"OK"`
      </td>
    </tr>

    <tr>
      <td>
        `secondary_button`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>

    <tr>
      <td>
        `tertiary_button`
      </td>

      <td>
        `[]const u8`
      </td>

      <td>
        `""`
      </td>
    </tr>
  </tbody>
</table>

**MessageDialogStyle**: `info`, `warning`, `critical`

**MessageDialogResult**: `primary`, `secondary`, `tertiary`

## FileFilter

```zig
const filters = [_]native_sdk.FileFilter{
    .{ .name = "Images", .extensions = &.{ "png", "jpg", "gif" } },
    .{ .name = "All Files", .extensions = &.{ "*" } },
};
```

## From JavaScript

Dialogs require the [builtin bridge](/docs/bridge/builtin-commands) to be enabled with an explicit policy that grants the `dialog` permission. JSON field names use camelCase:

```javascript
const files = await window.zero.invoke("native-sdk.dialog.openFile", {
  title: "Select a file",
  defaultPath: "/home",
  allowMultiple: true,
  allowDirectories: false,
});

const path = await window.zero.invoke("native-sdk.dialog.saveFile", {
  title: "Save as",
  defaultName: "untitled.txt",
});

const result = await window.zero.invoke("native-sdk.dialog.showMessage", {
  style: "warning",
  title: "Confirm",
  message: "Delete this item?",
  informativeText: "This action cannot be undone.",
  primaryButton: "Delete",
  secondaryButton: "Cancel",
});
```

---

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)