Native system dialogs for opening and saving files along with message dialogs.
This plugin requires a Rust version of at least 1.77.2
Platform | Level | Notes |
windows | | |
linux | | |
macos | | |
android | | Does not support folder picker |
ios | | Does not support folder picker |
Install the dialog plugin to get started.
Use your project’s package manager to add the dependency:
-
Run the following command in the src-tauri
folder to add the plugin to the project’s dependencies in Cargo.toml
:
-
Modify lib.rs
to initialize the plugin:
-
If you’d like create dialogs in JavaScript, install the npm package as well:
The dialog plugin is available in both JavaScript and Rust. Here’s how you can use it:
in JavaScript:
in Rust:
See all Dialog Options at the JavaScript API reference.
Shows a question dialog with Yes
and No
buttons.
Shows a question dialog with Ok
and Cancel
buttons.
Shows a message dialog with an Ok
button. Keep in mind that if the user closes the dialog it will return false
.
Open a file/directory selection dialog.
The multiple
option controls whether the dialog allows multiple selection or not, while the directory
, whether is a directory selection or not.
Open a file/directory save dialog.
Refer to the Rust API reference to see all available options.
Shows a question dialog with Absolutely
and Totally
buttons.
If you need a non blocking operation you can use show()
instead:
Shows a message dialog with an Ok
button. Keep in mind that if the user closes the dialog it will return false
.
If you need a non blocking operation you can use show()
instead:
If you need a non blocking operation you can use pick_file()
instead:
or, alternatively:
This permission set configures the types of dialogs
available from the dialog plugin.
All dialog types are enabled.
allow-ask
allow-confirm
allow-message
allow-save
allow-open
Permission Table
Identifier |
Description |
dialog:allow-ask
|
Enables the ask command without any pre-configured scope.
|
dialog:deny-ask
|
Denies the ask command without any pre-configured scope.
|
dialog:allow-confirm
|
Enables the confirm command without any pre-configured scope.
|
dialog:deny-confirm
|
Denies the confirm command without any pre-configured scope.
|
dialog:allow-message
|
Enables the message command without any pre-configured scope.
|
dialog:deny-message
|
Denies the message command without any pre-configured scope.
|
dialog:allow-open
|
Enables the open command without any pre-configured scope.
|
dialog:deny-open
|
Denies the open command without any pre-configured scope.
|
dialog:allow-save
|
Enables the save command without any pre-configured scope.
|
dialog:deny-save
|
Denies the save command without any pre-configured scope.
|
© 2024 Tauri Contributors. CC-BY / MIT