> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebind.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# rb.dialog

> Show native message boxes, yes or no questions, and file and folder pickers.

`rb.dialog` shows native dialogs. A script reaches for it to tell the user
something, ask a yes or no question, or let them pick a file or folder. A call
waits while the dialog is open; input, timers and other coroutines keep running.
On macOS a dialog call does not return; see
[rb.dialog on macOS](https://docs.rebind.gg/concepts/platforms.md#rb-dialog-on-macos).

**Needs:** a coroutine for every call, so call them inside `rb.run` or
`rb.async` (see [Where code runs](https://docs.rebind.gg/reference/sdk/globals.md#where-code-runs));
Windows.

This script asks for a log file, warns when the user cancels, and confirms the
choice:

```luau theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
-- rebind: min_sdk=3.10.4 name=example version=1.0.0 platforms=windows
rb.run(function()
  local path = rb.dialog.open_file({
    title = "Pick a log file",
    filters = { { name = "Logs", extensions = { "log", "txt" } } },
  })
  if not path then
    rb.dialog.message("No file picked.", { level = "warning" })
    return
  end
  if rb.dialog.confirm("Use " .. path .. "?") then
    print("picked:", path)
  end
end)
```

| Signature | Returns |
| - | - |
| `rb.dialog.message(text: string, options: DialogMessageOptions?) -> ()` | after it is dismissed |
| `rb.dialog.confirm(text: string, options: DialogMessageOptions?) -> boolean` | `true` for yes |
| `rb.dialog.open_file(options: DialogFileOptions?) -> string?` | a path, or `nil` on cancel |
| `rb.dialog.open_dir(options: DialogFileOptions?) -> string?` | a path, or `nil` on cancel |
| `rb.dialog.save_file(options: DialogFileOptions?) -> string?` | a path, or `nil` on cancel |

Outside a coroutine a call raises `Dialog.Message() must be called inside Run()`,
with the call's name.

Message options: `title` (default `"Message"` or `"Confirm"`) and `level`:
`"info"` (default), `"warning"` (or `"warn"`) or `"error"`, any case. File
options: `title`, `location` (the starting directory) and, except for
`open_dir`, `filters`, a list of `{ name, extensions }` with extensions written
without the dot.

A picker returns `nil` when the user cancels, so `if path then` tells the
cases apart. That needs `min_sdk=3.10.4`; on an older release a cancel returns
a value that tests true, so check `type(path) == "string"`. The path is
absolute, so `rb.file` and `rb.audio.play` refuse it; pass it to
`rb.system.exec` or show it to the user.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.