Native system dialogs for opening and saving files along with message dialogs.
Install the dialog plugin to get started.
Use your project’s package manager to add the dependency:
-
Run cargo add tauri-plugin-dialog
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:
© 2024 Tauri Contributors. CC-BY / MIT