Compose Multiplatform File Picker

repository·master·Indexed 18 days ago

https://github.com/wavesonics/compose-multiplatform-file-picker

A multiplatform Compose widget library providing access to native file picker dialogs for Windows, Android, Desktop/JVM, JS, and iOS. Includes components for picking single files, multiple files with extension filters, and directory selection.

Tokens
588
Snippets
4
Records
4
Agent score
13%

What's inside compose-multiplatform-file-picker

  1. Pick a single file with filters

    master

    Use the FilePicker composable to open a native file dialog. You can restrict the files shown by providing a list of extensions to the fileExtensions parameter. To trigger the dialog, set the show boolean state to true.

    Note: The callback provides a platformFile object which you can use to perform actions with the selected file.

    var showFilePicker by remember { mutableStateOf(false) }
    
    val fileType = listOf("jpg", "png")
    FilePicker(show = showFilePicker, fileExtensions = fileType) { platformFile ->
        showFilePicker = false
        // do something with the file
    }
  2. Pick multiple files with filters

    master

    Use the MultipleFilePicker composable to allow users to select more than one file. Similar to FilePicker, you can use fileExtensions to filter results. The callback provides a file object (representing the selection) for each picked file.

    var showFilePicker by remember { mutableStateOf(false) }
    
    val fileType = listOf("jpg", "png")
    MultipleFilePicker(show = showFilePicker, fileExtensions = fileType) { file ->
        showFilePicker = false
        // do something with the file
    }