Docs

Dialogs (window.Electron.dialogs)

Native OS dialogs, scoped to the calling window. Source: src/main/dialogs.ts, channel prefix dialogs:*. Always on, no config needed.

Methods

Method Returns Notes
showOpenDialog(options?: Electron.OpenDialogOptions) Promise<Electron.OpenDialogReturnValue> Options are passed straight through to Electron's dialog.showOpenDialog() — same fields (properties, filters, defaultPath, ...).
showSaveDialog(options?: Electron.SaveDialogOptions) Promise<Electron.SaveDialogReturnValue> Same pass-through to dialog.showSaveDialog().
showMessageBox(options: Electron.MessageBoxOptions) Promise<Electron.MessageBoxReturnValue> Same pass-through to dialog.showMessageBox(). Defaults to { message: '' } if options is omitted.
showErrorBox(options?: { title?: string; content?: string }) Promise<void> Defaults: title: 'Error', content: ''.

Every dialog is attached to the BrowserWindow that owns the calling webContents, so it appears as a sheet/modal on the right window rather than floating unattached — falls back to an unattached dialog only if the sender's window can't be resolved.

Example

const result = await window.Electron.dialogs.showOpenDialog({
  properties: ['openFile'],
  filters: [{ name: 'Images', extensions: ['png', 'jpg'] }],
});
if (!result.canceled) console.log(result.filePaths[0]);

.safe

Fully mirrored — window.Electron.safe.dialogs.* resolves { ok: true, data } / { ok: false, error } instead of throwing.

Last updated on July 18, 2026