@@ -91,14 +91,20 @@ in Rust:
91
91
- [ Build a Message Dialog] ( #build-a-message-dialog )
92
92
- [ Build a File Selector Dialog] ( #build-a-file-selector-dialog )
93
93
94
- ---
94
+ :::note
95
+ The file dialog APIs returns file system paths on Linux, Windows and macOS.
96
+
97
+ On iOS, a ` file://<path> ` URIs are returned.
98
+
99
+ On Android, [ content URIs] are returned.
100
+
101
+ The [ filesystem plugin] works with any path format out of the box.
102
+ :::
95
103
96
104
### JavaScript
97
105
98
106
See all [ Dialog Options] ( /reference/javascript/dialog/ ) at the JavaScript API reference.
99
107
100
- { /* ASK */ }
101
-
102
108
#### Create Yes/No Dialog
103
109
104
110
Shows a question dialog with ` Yes ` and ` No ` buttons.
@@ -118,8 +124,6 @@ console.log(answer);
118
124
// Prints boolean to the console
119
125
```
120
126
121
- { /* CONFIRM */ }
122
-
123
127
#### Create Ok/Cancel Dialog
124
128
125
129
Shows a question dialog with ` Ok ` and ` Cancel ` buttons.
@@ -139,8 +143,6 @@ console.log(confirmation);
139
143
// Prints boolean to the console
140
144
```
141
145
142
- { /* MESSAGE */ }
143
-
144
146
#### Create Message Dialog
145
147
146
148
Shows a message dialog with an ` Ok ` button. Keep in mind that if the user closes the dialog it will return ` false ` .
@@ -154,8 +156,6 @@ import { message } from '@tauri-apps/plugin-dialog';
154
156
await message (' File not found' , { title: ' Tauri' , kind: ' error' });
155
157
```
156
158
157
- { /* OPEN */ }
158
-
159
159
#### Open a File Selector Dialog
160
160
161
161
Open a file/directory selection dialog.
@@ -176,8 +176,6 @@ console.log(file);
176
176
// Prints file path or URI
177
177
```
178
178
179
- { /* SAVE */ }
180
-
181
179
#### Save to File Dialog
182
180
183
181
Open a file/directory save dialog.
@@ -211,26 +209,24 @@ Refer to the [Rust API reference](https://docs.rs/tauri-plugin-dialog/) to see a
211
209
Shows a question dialog with ` Absolutely ` and ` Totally ` buttons.
212
210
213
211
``` rust
214
- use tauri_plugin_dialog :: DialogExt ;
212
+ use tauri_plugin_dialog :: { DialogExt , MessageDialogButtons } ;
215
213
216
214
let answer = app . dialog ()
217
215
. message (" Tauri is Awesome" )
218
216
. title (" Tauri is Awesome" )
219
- . ok_button_label (" Absolutely" )
220
- . cancel_button_label (" Totally" )
217
+ . buttons (MessageDialogButtons :: OkCancelCustom (" Absolutely" , " Totally" ))
221
218
. blocking_show ();
222
219
```
223
220
224
221
If you need a non blocking operation you can use ` show() ` instead:
225
222
226
223
``` rust
227
- use tauri_plugin_dialog :: DialogExt ;
224
+ use tauri_plugin_dialog :: { DialogExt , MessageDialogButtons } ;
228
225
229
226
app . dialog ()
230
227
. message (" Tauri is Awesome" )
231
228
. title (" Tauri is Awesome" )
232
- . ok_button_label (" Absolutely" )
233
- . cancel_button_label (" Totally" )
229
+ . buttons (MessageDialogButtons :: OkCancelCustom (" Absolutely" , " Totally" ))
234
230
. show (| result | match result {
235
231
true => // do something,
236
232
false => // do something,
@@ -254,13 +250,13 @@ let ans = app.dialog()
254
250
If you need a non blocking operation you can use ` show() ` instead:
255
251
256
252
``` rust
257
- use tauri_plugin_dialog :: {DialogExt , MessageDialogKind };
253
+ use tauri_plugin_dialog :: {DialogExt , MessageDialogButtons , MessageDialogKind };
258
254
259
255
app . dialog ()
260
256
. message (" Tauri is Awesome" )
261
257
. kind (MessageDialogKind :: Info )
262
258
. title (" Information" )
263
- . ok_button_label ( " Absolutely" )
259
+ . buttons ( MessageDialogButtons :: OkCustom ( " Absolutely" ) )
264
260
. show (| result | match result {
265
261
true => // do something,
266
262
false => // do something,
@@ -316,3 +312,6 @@ app.dialog()
316
312
```
317
313
318
314
<PluginPermissions plugin = { frontmatter .plugin } />
315
+
316
+ [ content URIs ] : https://developer.android.com/guide/topics/providers/content-provider-basics
317
+ [ filesystem plugin ] : /plugin/file-system
0 commit comments