Skip to main content

dialog

@tauri-apps/api / dialog

Module: dialog

Native system dialogs for opening and saving files.

This package is also accessible with window.__TAURI__.dialog when tauri.conf.json > build > withGlobalTauri is set to true.

The APIs must be allowlisted on tauri.conf.json:

{
"tauri": {
"allowlist": {
"dialog": {
"all": true, // enable all dialog APIs
"open": true, // enable file open API
"save": true // enable file save API
}
}
}
}

It is recommended to allowlist only the APIs you use for optimal bundle size and security.

Interfaces

Functions

open

open(options?): Promise<string | string[]>

Open a file/directory selection dialog

Parameters

NameType
optionsOpenDialogOptions

Returns

Promise<string | string[]>

A promise resolving to the selected path(s)

Defined in

dialog.ts:73


save

save(options?): Promise<string>

Open a file/directory save dialog.

Parameters

NameType
optionsSaveDialogOptions

Returns

Promise<string>

A promise resolving to the selected path.

Defined in

dialog.ts:94