Skip to content

aleksandar-stefanovic/compose-material-data-table

Repository files navigation

maven central version

A Kotlin & Compose Multiplatform implementation of the Material 2 Data Table.

image

Setup

Using libs.versions.toml

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" }

Using direct dependency notation

kotlin {
    sourceSets {
        commonMain.dependencies {
            implementation("io.github.aleksandar-stefanovic:composematerialdatatable:1.2.2")
        }
    }
}

Features

  • 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.

Supported platforms

Right now, it is tested and working on:

  • Desktop
  • Android
  • WASM (with the limitation of not having number formatting)
  • iOS

Example

Gradle submodule sample contains a working example of the Table implementation, see Sample App.kt.

About

A Kotlin Multiplatform and Compose Multiplatform implementation of the Material 2 Data Table

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages