A Kotlin & Compose Multiplatform implementation of the Material 2 Data Table.
To add the dependency to your Kotlin Multiplatform project, open the build.gradle.kts
of your shared module, then
kotlin {
sourceSets {
commonMain.dependencies {
implementation(libs.composematerialdatatable)
}
}
}
and, in your libs.versions.toml
, add:
composematerialdatatable = "1.2.2"
[libraries]
composematerialdatatable = { module = "io.github.aleksandar-stefanovic:composematerialdatatable", version.ref = "composematerialdatatable" }
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.aleksandar-stefanovic:composematerialdatatable:1.2.2")
}
}
}
- Column width settings
- Fixed — the column with use the specified width
- Wrap Content — the column will spread to the intrinsic width of the content
- Flex — the column will use remaining available space, split across all Flex columns by weight
- Sorting — click on the table header to toggle between sorting ascending, descending, and resetting
- Column types
- String
- Int
- Double
- Date
- Dropdown (specific set of values)
- Checkbox (Boolean)
- Column aligning
- Text selection (works but selecting multiple cells at once just concatenates them without whitespace at the moment)
- Toggleable selection column (first column with tri-state checkbox header and checkbox cells, which emits events on interaction)
- Filtering
- Client-based pagination
- Horizontal and vertical scrolling
For the planned features, see Issues.
Right now, it is tested and working on:
- Desktop
- Android
- WASM (with the limitation of not having number formatting)
- iOS
Gradle submodule sample
contains a working example of the Table
implementation, see Sample App.kt.