Skip to content

Commit

Permalink
📝 Update README documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceglb committed Jul 18, 2024
1 parent eecc5dd commit 11d132b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Compose Multiplatform integration made simple:

```kotlin
// Pick files from Compose
val launcher = rememberFilePickerLauncher(PickerMode.Multiple) { files ->
val launcher = rememberFilePickerLauncher(mode = PickerMode.Multiple()) { files ->
// Handle picked files
}

Expand Down Expand Up @@ -121,9 +121,13 @@ You can pick files in different modes with `PickerMode`. The mode will change th

```kotlin
val singleMode = PickerMode.Single
val multipleMode = PickerMode.Multiple
val multipleMode = PickerMode.Multiple()
```

#### Max items

On Android and iOS, when using `PickerType` `Image`, `Video` or `ImageAndVideo`, we can use `PickerMode.Multiple(maxItems = X)` to limit the number of picked files. The value must be between 1 and 50. Default value is `null` (no limit).

### Launch the picker

You can launch the picker with `FileKit.pickFile` or `rememberFilePickerLauncher`:
Expand All @@ -140,7 +144,7 @@ val file = FileKit.pickFile(
// FileKit Compose
val launcher = rememberFilePickerLauncher(
type = PickerSelectionType.ImageAndVideo,
mode = PickerSelectionMode.Multiple,
mode = PickerSelectionMode.Multiple(),
title = "Pick a media",
initialDirectory = "/custom/initial/path"
) { files ->
Expand Down Expand Up @@ -262,7 +266,7 @@ FileKit uses the native file picker API on each platform:
- On Android, it uses `PickVisualMedia`, `OpenDocument` and `OpenDocumentTree` contracts.
- On iOS, it uses both `UIDocumentPickerViewController` and `PHPickerViewController` APIs.
- On macOS, it uses the `NSOpenPanel` API.
- On JVM, it uses JNA to access the file system on Windows and macOS and Awt FileDialog on Linux.
- On JVM, it uses JNA to access the file system on Windows and macOS and XDG Desktop Portal on Linux.
- On WASM / JS, it uses the `input` element with the `file` type.

Also, FileKit uses the bear minimum of dependencies to be as lightweight as possible.
Expand All @@ -271,6 +275,7 @@ FileKit Core uses the following libraries:
- [KotlinX Coroutines](https://github.com/Kotlin/kotlinx.coroutines)
- Only Android: [AndroidX Activity KTX](https://developer.android.com/jetpack/androidx/releases/activity)
- Only JVM: [Java Native Access - JNA](https://github.com/java-native-access/jna/tree/master)
- Only JVM: [XDG Desktop Portal](https://github.com/hypfvieh/dbus-java)

FileKit Compose uses the following libraries:
- [Jetbrains Compose Runtime](https://github.com/JetBrains/compose-multiplatform)
Expand Down

0 comments on commit 11d132b

Please sign in to comment.