DataTableHeader

@Immutable
data class DataTableHeader<T>(val key: String, val title: String = "", val value: (T) -> Any?? = null, val sortable: Boolean = true, val width: Dp? = null, val align: TextAlign = TextAlign.Start, val fixed: Boolean = false, val visible: Boolean = true, val maxLines: Int = Int.MAX_VALUE, val overflow: TextOverflow = TextOverflow.Clip, val comparator: <Error class: unknown class><T>? = null, val children: List<DataTableHeader<T>>? = null, val headerContent: @Composable () -> Unit? = null, val cellContent: @Composable (T) -> Unit? = null)(source)

Describes a column in the DataTable.

Parameters

key

Stable unique identifier for this column. Also used for sorting.

title

Text label shown in the default header when headerContent is not provided.

value

Extractor invoked for each row item to produce a displayable value.

sortable

Whether this column supports sorting via the built-in header interactions.

width

Fixed width for the column. If null, the column is laid out with weight to fill space.

align

Horizontal alignment for header text and default cell text.

fixed

When true, the column is frozen (pinned) to the left and does not scroll horizontally. Frozen columns must have an explicit width; DataTable throws if one does not.

visible

When false, the column is excluded from rendering. Defaults to true.

maxLines

Maximum lines for default text rendering. Defaults to Int.MAX_VALUE.

overflow

Text overflow strategy for default text rendering.

comparator

Optional custom comparator for sorting. When provided, takes precedence over the default Comparable-based sort.

children

Optional nested headers. When provided, this header becomes a group: it is drawn as a band above its children, spanning them, and only the leaf headers render as actual columns. A group's own value, width, and sorting settings are ignored — it takes its width from the leaves beneath it, which must be either all fixed-width or all weighted.

headerContent

Optional composable to fully customize the header cell for this column.

cellContent

Optional composable to fully customize each body cell for this column.

Constructors

Link copied to clipboard
constructor(key: String, title: String = "", value: (T) -> Any?? = null, sortable: Boolean = true, width: Dp? = null, align: TextAlign = TextAlign.Start, fixed: Boolean = false, visible: Boolean = true, maxLines: Int = Int.MAX_VALUE, overflow: TextOverflow = TextOverflow.Clip, comparator: <Error class: unknown class><T>? = null, children: List<DataTableHeader<T>>? = null, headerContent: @Composable () -> Unit? = null, cellContent: @Composable (T) -> Unit? = null)

Properties

Link copied to clipboard
val align: TextAlign
Link copied to clipboard
val cellContent: @Composable (T) -> Unit? = null
Link copied to clipboard
Link copied to clipboard
val comparator: <Error class: unknown class><T>? = null
Link copied to clipboard
val fixed: Boolean = false
Link copied to clipboard
val headerContent: @Composable () -> Unit? = null
Link copied to clipboard
val key: String
Link copied to clipboard
Link copied to clipboard
val overflow: TextOverflow
Link copied to clipboard
val sortable: Boolean = true
Link copied to clipboard
Link copied to clipboard
val value: (T) -> Any?? = null
Link copied to clipboard
val visible: Boolean = true
Link copied to clipboard
val width: Dp? = null