Skip to main content
openFilePicker shows the platform’s native file dialog and returns the selected file as a PlatformFile, or a list of files in multiple mode.

Usage

The result is null when the user cancels. Failures go to onError in Compose, or are thrown as a FileKitDialogException by the suspend API. See Results and errors.

Try it

This is the FileKit sample running in your browser. Pick files, switch the selection mode or restrict extensions, then open a file to inspect its metadata.

Options

In Compose, pass these options to rememberFilePickerLauncher. launch() takes no arguments.
FileKitType
default:"File()"
Which files the user can pick. File() allows any file.
FileKitMode
default:"Single"
How many files the user can pick. The result type follows the mode.
PlatformFile?
default:"null"
Folder the dialog opens in. Ignored on Android and the web.
FileKitDialogSettings
default:"createDefault()"
Title, parent window, and other per-platform settings.

Filter by extension

Pass the extensions without the dot:
FileKitType.File also accepts a List<String> or a Set<String>.

Pick multiple files

FileKitMode.Multiple() returns a List<PlatformFile>, or null when the user cancels:
The iOS gallery picker and the Android Photo Picker enforce maxItems in their UI. Other dialogs, including Android’s document picker fallback, have no native limit, so FileKit keeps the first maxItems files in the order the platform returns them.

Track progress

SingleWithState and MultipleWithState report each step as a FileKitPickerState, which lets you show a loading indicator while large files are prepared. In Compose, each state reaches onResult. The suspend API returns a Flow:
Progress matters most for iOS gallery picks, where FileKit copies each item before returning it. Other dialogs deliver every state at once when they close. See Results and errors for the full state contract.

Platform notes