Table

fun <T : Any, C, E> Table(items: PagingData<T>?, state: TableState<C>, columns: ImmutableList<ColumnSpec<T, C, E>>, tableData: E, modifier: Modifier = Modifier, placeholderRow: @Composable () -> Unit? = null, emptyContent: @Composable TableEmptyScope.() -> Unit = TableDefaults.EmptyContent, loadingContent: @Composable () -> Unit = PagedTableDefaults.LoadingContent, errorContent: @Composable PagedTableErrorScope.() -> Unit = PagedTableDefaults.ErrorContent, loadingIndicator: @Composable () -> Unit? = PagedTableDefaults.LoadingIndicator, errorBar: @Composable PagedTableErrorScope.() -> Unit? = PagedTableDefaults.ErrorBar, rowKey: (item: T?, index: Int) -> Any = DefaultPagedRowKey, onRowClick: (T) -> Unit? = null, onRowLongClick: (T) -> Unit? = null, rowBlocks: RowBlocks<T>? = null, contextMenu: @Composable (item: T, pos: Offset, dismiss: () -> Unit) -> Unit? = null, customization: TableCustomization<T, C> = DefaultTableCustomization(), colors: TableColors = TableDefaults.colors(), typography: TableTypography = TableDefaults.typography(), strings: StringProvider = DefaultStrings, filterChips: TableFilterChipStyle<C> = TableFilterChipDefaults.style(), verticalState: LazyListState = rememberLazyListState(), horizontalState: ScrollState = rememberScrollState(), icons: TableHeaderIcons = TableHeaderDefaults.icons(), columnMenu: ColumnMenuBuilder<C> = ColumnMenuDefaults.builder(), shape: Shape = RoundedCornerShape(4.dp), border: BorderStroke? = null)

Composable data table with paging support.

This overload wraps PagingData and delegates to the core Table composable.

  • Columns are described by columns (ColumnSpec).

  • Data is provided via items (PagingData).

  • Sorting, filters, ordering and selection are controlled by state.

Generic parameters:

  • T actual row item type.

  • C column key type.

  • E table data type - shared state accessible in headers, footers, and edit cells.

Parameters

items

paging data container with loaded items

state

mutable table state (sorting, filters, order, selection)

columns

list of visible/available column specifications

tableData

current table data instance - accessible in headers, footers, and edit cells

modifier

layout modifier for the whole table

placeholderRow

optional row content shown when an item is null

emptyContent

body content shown once items has loaded with no rows. See TableEmptyScope.

loadingContent

body content shown while there are no rows yet and the first ones are loading: items is null, or its size is 0 while the pager reports Loading.

errorContent

body content shown when loading fails before any row exists; its PagedTableErrorScope carries the failure and retries the failed position.

loadingIndicator

shown at the top of the rows while more rows load, once loading has lasted 400 ms (shorter pulses from scroll preloads never show it); null disables it.

errorBar

shown at the bottom of the rows when a load fails while rows are on screen; null disables it. While shown it overlays the bottom of the rows (the last row, or an unpinned footer scrolled into view).

rowKey

stable key for rows; defaults to index

onRowClick

row primary action handler

onRowLongClick

optional long-press handler

rowBlocks

row blocks declared by identity (RowBlocks.blockOf); requires a stable rowKey. Bands derive over loaded adjacent runs, so a placeholder breaks a band and a partially loaded block extends as its pages arrive. Without RowBlocks.onCommit blocks are display-only; with it a drop commits only when its landing neighbours are loaded — against a placeholder the gesture snaps back and nothing is emitted. Apply commits in your data layer by RowBlockMove.blockId: a paged consumer holds no materialized list for applyRowBlockMove, and the data layer is what knows full block membership, including rows never loaded here.

contextMenu

optional context menu host, invoked with item and absolute position

customization

styling hooks for rows and cells

colors

container/content colors

typography

text styles of the header, body, footer and group rows

strings

string provider for UI text

filterChips

how the chips of the active filters row are drawn

verticalState

list scroll state

horizontalState

horizontal scroll state of the whole table

icons

header icons used for sort and filter affordances

columnMenu

shapes the column header menu; receives the default sections per column

shape

surface shape of the table

border

outer border stroke; null uses theme default, TableDefaults.NoBorder disables border


fun <T : Any, C> Table(items: PagingData<T>?, state: TableState<C>, columns: ImmutableList<ColumnSpec<T, C, Unit>>, modifier: Modifier = Modifier, placeholderRow: @Composable () -> Unit? = null, emptyContent: @Composable TableEmptyScope.() -> Unit = TableDefaults.EmptyContent, loadingContent: @Composable () -> Unit = PagedTableDefaults.LoadingContent, errorContent: @Composable PagedTableErrorScope.() -> Unit = PagedTableDefaults.ErrorContent, loadingIndicator: @Composable () -> Unit? = PagedTableDefaults.LoadingIndicator, errorBar: @Composable PagedTableErrorScope.() -> Unit? = PagedTableDefaults.ErrorBar, rowKey: (item: T?, index: Int) -> Any = DefaultPagedRowKey, onRowClick: (T) -> Unit? = null, onRowLongClick: (T) -> Unit? = null, rowBlocks: RowBlocks<T>? = null, contextMenu: @Composable (item: T, pos: Offset, dismiss: () -> Unit) -> Unit? = null, customization: TableCustomization<T, C> = DefaultTableCustomization(), colors: TableColors = TableDefaults.colors(), typography: TableTypography = TableDefaults.typography(), strings: StringProvider = DefaultStrings, filterChips: TableFilterChipStyle<C> = TableFilterChipDefaults.style(), verticalState: LazyListState = rememberLazyListState(), horizontalState: ScrollState = rememberScrollState(), icons: TableHeaderIcons = TableHeaderDefaults.icons(), columnMenu: ColumnMenuBuilder<C> = ColumnMenuDefaults.builder(), shape: Shape = RoundedCornerShape(4.dp), border: BorderStroke? = null)

Composable data table with paging support.

This overload wraps PagingData and delegates to the core Table composable.

  • Columns are described by columns (ColumnSpec).

  • Data is provided via items (PagingData).

  • Sorting, filters, ordering and selection are controlled by state.

Generic parameters:

  • T actual row item type.

  • C column key type.

Parameters

items

paging data container with loaded items

state

mutable table state (sorting, filters, order, selection)

columns

list of visible/available column specifications

modifier

layout modifier for the whole table

placeholderRow

optional row content shown when an item is null

emptyContent

body content shown once items has loaded with no rows. See TableEmptyScope.

loadingContent

body content shown while there are no rows yet and the first ones are loading: items is null, or its size is 0 while the pager reports Loading.

errorContent

body content shown when loading fails before any row exists; its PagedTableErrorScope carries the failure and retries the failed position.

loadingIndicator

shown at the top of the rows while more rows load, once loading has lasted 400 ms (shorter pulses from scroll preloads never show it); null disables it.

errorBar

shown at the bottom of the rows when a load fails while rows are on screen; null disables it. While shown it overlays the bottom of the rows (the last row, or an unpinned footer scrolled into view).

rowKey

stable key for rows; defaults to index

onRowClick

row primary action handler

onRowLongClick

optional long-press handler

rowBlocks

row blocks declared by identity (RowBlocks.blockOf); requires a stable rowKey. Bands derive over loaded adjacent runs, so a placeholder breaks a band and a partially loaded block extends as its pages arrive. Without RowBlocks.onCommit blocks are display-only; with it a drop commits only when its landing neighbours are loaded — against a placeholder the gesture snaps back and nothing is emitted. Apply commits in your data layer by RowBlockMove.blockId: a paged consumer holds no materialized list for applyRowBlockMove, and the data layer is what knows full block membership, including rows never loaded here.

contextMenu

optional context menu host, invoked with item and absolute position

customization

styling hooks for rows and cells

colors

container/content colors

typography

text styles of the header, body, footer and group rows

strings

string provider for UI text

filterChips

how the chips of the active filters row are drawn

verticalState

list scroll state

horizontalState

horizontal scroll state of the whole table

icons

header icons used for sort and filter affordances

columnMenu

shapes the column header menu; receives the default sections per column

shape

surface shape of the table

border

outer border stroke; null uses theme default, TableDefaults.NoBorder disables border