
Compose Data Table
This library is an implementation of the Material Design data table for Compose.
The original code is derived from the implementation that was removed from Compose pre-1.0. The goal is to implement the entire Material Design spec for data tables.

Getting started
Add the dependency to your gradle build file:
Non-material version:
implementation("com.seanproctor:datatable:<VERSION>")
Material 3:
implementation("com.seanproctor:datatable-material3:<VERSION>")
Draw a table
var selectedRow by remember { mutableStateOf<Int?>(null) }
DataTable(
columns = listOf(
DataColumn {
Text("Header A")
},
DataColumn {
Text("Header B")
},
DataColumn(Alignment.CenterEnd) {
Text("Header C")
},
)
) {
row {
onClick = { selectedRow = 0 }
cell { Text("Cell A1") }
cell { Text() }
cell { Text() }
}
row {
onClick = { selectedRow = }
cell { Text() }
cell { Text() }
cell { Text() }
}
}
Draw paginated table
PaginatedDataTable(
columns = listOf(
DataColumn {
Text("Column1")
},
DataColumn {
Text("Column2")
},
DataColumn {
Text("Column3")
},
),
state = rememberPaginatedDataTableState(
count = 100,
pageSize = PageSize.FillMaxHeight
),
) { fromIndex, toIndex ->
for (rowIndex in fromIndex until toIndex) {
row {
onClick = { println() }
cell {
Text()
}
cell {
Text()
}
cell {
Text()
}
}
}
}