Documentation
On this page

Function · Desktop Services

showOpenFileDialog

Displays a native open-file dialog.

@sharpts/gui · SharpTS 572a2e31be0e

Signature

TypeScript
showOpenFileDialog(options: OpenFileDialogOptions = {}): Promise<string[]>

Parameters

NameTypeDescription
optionsOpenFileDialogOptions
Default: {}
Title, multi-select, and filter options.

Returns

Promise<string[]> — The selected file paths, or an empty array when canceled.

Remarks

Returned paths are local filesystem paths. Files exposed only through a virtual storage provider are omitted.

Throws

  • When no desktop window is available, filters are invalid, or the native picker fails.

Examples

TypeScript
import { showOpenFileDialog } from "@sharpts/gui";

const paths = await showOpenFileDialog({
    allowMultiple: true,
    filters: [{ name: "Images", patterns: ["*.png", "*.jpg"] }]
});
for (const path of paths) console.log(path);

Source

src/SharpTS.Gui.Sdk/GuiPackage/runtime.ts:1491 at SharpTS revision 572a2e31be0e2a09be0138bc44501b34d6245b51.