Table

Generated from docs.json. 394 exposed values, types, and type aliases, in the order the module exposes them.

Headless table state and row-model pipeline: a port of TanStack Table core as pure functions.

There is no table instance. You own the State, you own the data, and every function here takes a Config row and a State and gives you a value back.

Columns and headers

Column and header types, the builders that assemble a Config row's column list, and the readers that walk it back.

Types

Column

type alias Column row =
    Table.Column row

A column definition. Build one with column, group, or display.

Config

type alias Config row =
    Table.Config row

Everything about a table that is not state: the columns, how to find row ids and sub-rows, and every feature flag.

It is a plain record, so { cfg | manualSorting = True } works for any flag that has no builder. Later versions of this package may add fields, which is a breaking change for code that pattern matches on the record but not for record update.

Fields, with the defaults config sets:

  • columns : List (Column row)
  • getRowId : Maybe (row -> Int -> Maybe String -> String), Nothing (index paths)
  • getSubRows : row -> List row, none
  • manualSorting, manualFiltering, manualGrouping, manualExpanding, manualPagination : Bool, all False; True makes that stage return its input
  • enableSorting, enableMultiSort, enableSortingRemoval, enableMultiRemove : Bool, all True; maxMultiSortColCount : Int, unlimited; sortDescFirst : Maybe Bool, Nothing (automatic per column)
  • enableFilters, enableColumnFilters, enableGlobalFilter : Bool, all True; getColumnCanGlobalFilter : Maybe (Column row -> Bool), Nothing (strings and numbers); filterFromLeafRows : Bool, False; maxLeafRowFilterDepth : Int, 100; globalFilterFn : Maybe FilterFn, Nothing (automatic)
  • enableGrouping : Bool, True; groupedColumnMode : GroupedColumnMode, groupedColumnsReorder
  • enableExpanding : Bool, True; getRowCanExpand, getIsRowExpanded : Maybe (Row row -> Bool), Nothing; paginateExpandedRows : Bool, True
  • pageCount, rowCount : Maybe Int, Nothing (manual pagination only)
  • enableRowSelection, enableMultiRowSelection, enableSubRowSelection, enableRowPinning : Row row -> Bool, all always True; keepPinnedRows : Bool, True
  • enableColumnPinning, enableHiding : Bool, True; defaultColumn : SizeDefaults, size 150, min 20, max unlimited
  • enableCellSpanning, enableCellSelection, enableCellRangeSelection, enableMultiCellRangeSelection : Bool, all True; cellSelectionFilter : Maybe (Cell -> Bool), Nothing

State

type alias State =
    Table.State

Every state slice the pipeline reads. Start from initialState and update it yourself, directly or through the transition functions in this module.

  • sorting : List SortColumn, in priority order
  • columnFilters : List ColumnFilter
  • globalFilter : Value, Null for none
  • grouping : List String, column ids in grouping order
  • expanded : Expanded
  • rowSelection : Set String, selected row ids
  • pagination : Pagination
  • columnOrder : List String, empty for definition order
  • columnVisibility : Dict String Bool, missing means visible
  • columnPinning : ColumnPinning
  • columnSizing : Dict String Float, missing means the column's own size
  • rowPinning : RowPinning
  • cellSelection : List CellSelectionRange

Row

type alias Row row =
    Table.Row row

One row of a row model.

RowModel

type alias RowModel row =
    Table.RowModel row

The output of a pipeline stage: the row tree, the same rows flattened depth first, and a lookup by row id.

HeaderGroup

type alias HeaderGroup row =
    Table.HeaderGroup row

One header row.

Cell

type alias Cell =
    Table.Cell

One cell of one row, computed on demand.

Expanded

type alias Expanded =
    Table.Expanded

Which rows are expanded. ExpandAll is TanStack's expanded: true.

SortUndefined

type alias SortUndefined =
    Table.SortUndefined

Where Null values land when a column is sorted.

GroupedColumnMode

type alias GroupedColumnMode =
    Table.GroupedColumnMode

What the leaf column list does with grouped columns.

SortColumn

type alias SortColumn =
    Table.SortColumn

One entry of State.sorting.

ColumnFilter

type alias ColumnFilter =
    Table.ColumnFilter

One entry of State.columnFilters.

Pagination

type alias Pagination =
    Table.Pagination

The page the paginated row model returns.

ColumnPinning

type alias ColumnPinning =
    Table.ColumnPinning

Column ids pinned to either edge.

RowPinning

type alias RowPinning =
    Table.RowPinning

Row ids pinned to the top or the bottom.

SizeDefaults

type alias SizeDefaults =
    Table.SizeDefaults

The default sizing of a column, in pixels.

Elm cannot re-export the variants of a type that is declared in another module, so the three unions above are abstract here and come with one function per variant.

expandAll

expandAll : Table.Expanded

Every row is expanded, whatever State.rowSelection holds. TanStack's expanded: true.

expandedIds

expandedIds : Set String -> Table.Expanded

Only the rows with these ids are expanded.

expandedIdsOf

expandedIdsOf : Table.Expanded -> Maybe (Set String)

The expanded row ids, or Nothing when every row is expanded.

sortNullsFirst

sortNullsFirst : Table.SortUndefined

Sort Null cell values before every other value.

sortNullsLast

sortNullsLast : Table.SortUndefined

Sort Null cell values after every other value. This is the default.

sortNullsAsMinusOne

sortNullsAsMinusOne : Table.SortUndefined

Sort Null cell values as if they compared -1 against anything else, TanStack's sortUndefined: -1.

sortNullsAsPlusOne

sortNullsAsPlusOne : Table.SortUndefined

Sort Null cell values as if they compared 1 against anything else, TanStack's sortUndefined: 1.

groupedColumnsReorder

groupedColumnsReorder : Table.GroupedColumnMode

Move grouped columns to the front of the leaf column list.

groupedColumnsRemove

groupedColumnsRemove : Table.GroupedColumnMode

Drop grouped columns from the leaf column list.

groupedColumnsIgnore

groupedColumnsIgnore : Table.GroupedColumnMode

Leave grouped columns where they are.

Configuration

config

config : List (Table.Column row) -> Table.Config row

A configuration for a list of columns, with TanStack's defaults for every flag.

config [ Table.column "firstName" (.firstName >> Value.String) ]

initialState

initialState : Table.State

The state a table starts in: nothing sorted, nothing filtered, nothing grouped, page 0 of size 10.

withGetRowId

withGetRowId : (row -> Int -> Maybe String -> String) -> Table.Config row -> Table.Config row

Give rows stable ids. The function receives the datum, its index among its siblings, and its parent's row id.

Without it, root rows are "0", "1", and children are "0.1", "0.2".

withSubRows

withSubRows : (row -> List row) -> Table.Config row -> Table.Config row

Tell the core row model how to reach a row's children.

withDefaultColumn

withDefaultColumn : Table.SizeDefaults -> Table.Config row -> Table.Config row

Override the default column sizing (150, 20, 9007199254740991).

withGlobalFilterFn

withGlobalFilterFn : Table.FilterFn.FilterFn -> Table.Config row -> Table.Config row

Set the filter function the global filter uses.

withRowSelection

withRowSelection : (Table.Row row -> Bool) -> Table.Config row -> Table.Config row

Decide per row whether it can be selected.

Building columns

column

column : String -> (row -> Table.Value.Value) -> Table.Column row

An accessor column: an id and a way to read a cell value.

Table.column "age" (.age >> toFloat >> Value.Number)

group

group : String -> List (Table.Column row) -> Table.Column row

A group column: an id and the columns nested under it. Group columns have no accessor and no cells, they only produce header rows.

display

display : String -> Table.Column row

A display column: an id, no accessor, no children.

withHeader

withHeader : String -> Table.Column row -> Table.Column row

Set the header text.

withFooter

withFooter : String -> Table.Column row -> Table.Column row

Set the footer text.

withSortFn

withSortFn : Table.SortFn.SortFn -> Table.Column row -> Table.Column row

Sort this column with a built-in sort function.

withCustomSort

withCustomSort : (Table.Row row -> Table.Row row -> Order) -> Table.Column row -> Table.Column row

Sort this column with a comparison on whole rows.

withSortDescFirst

withSortDescFirst : Bool -> Table.Column row -> Table.Column row

Make the first click on this column sort descending.

withInvertSorting

withInvertSorting : Bool -> Table.Column row -> Table.Column row

Invert the sort direction of this column.

withSortUndefined

withSortUndefined : Table.SortUndefined -> Table.Column row -> Table.Column row

Decide where Null values land when this column is sorted.

withEnableSorting

withEnableSorting : Bool -> Table.Column row -> Table.Column row

Allow or forbid sorting on this column.

withEnableMultiSort

withEnableMultiSort : Bool -> Table.Column row -> Table.Column row

Allow or forbid this column in a multi-sort.

withFilterFn

withFilterFn : Table.FilterFn.FilterFn -> Table.Column row -> Table.Column row

Filter this column with a built-in filter function.

withCustomFilter

withCustomFilter : (Table.Row row -> Table.Value.Value -> Bool) -> Table.Column row -> Table.Column row

Filter this column with a predicate on whole rows.

withEnableColumnFilter

withEnableColumnFilter : Bool -> Table.Column row -> Table.Column row

Allow or forbid a column filter on this column.

withEnableGlobalFilter

withEnableGlobalFilter : Bool -> Table.Column row -> Table.Column row

Include or exclude this column from the global filter.

withAggregationFn

withAggregationFn : Table.AggregationFn.AggregationFn -> Table.Column row -> Table.Column row

Aggregate this column's values on group rows.

withGetGroupingValue

withGetGroupingValue : (row -> Int -> Table.Value.Value) -> Table.Column row -> Table.Column row

Read the value this column groups by, when it differs from the accessor. The second argument is the row's index, mirroring TanStack's getGroupingValue(originalRow, index, row).

withGetUniqueValues

withGetUniqueValues : (row -> List Table.Value.Value) -> Table.Column row -> Table.Column row

Read the faceting values of a row, when one cell holds several.

withEnableGrouping

withEnableGrouping : Bool -> Table.Column row -> Table.Column row

Allow or forbid grouping by this column.

withEnableHiding

withEnableHiding : Bool -> Table.Column row -> Table.Column row

Allow or forbid hiding this column.

withEnablePinning

withEnablePinning : Bool -> Table.Column row -> Table.Column row

Allow or forbid pinning this column.

withSize

withSize : Float -> Table.Column row -> Table.Column row

Set this column's size in pixels.

withMinSize

withMinSize : Float -> Table.Column row -> Table.Column row

Set this column's minimum size in pixels.

withMaxSize

withMaxSize : Float -> Table.Column row -> Table.Column row

Set this column's maximum size in pixels.

Reading columns

columnId

columnId : Table.Column row -> String

The column id.

columnHeader

columnHeader : Table.Column row -> Maybe String

The header text, when one was set.

columnFooter

columnFooter : Table.Column row -> Maybe String

The footer text, when one was set.

columnDepth

columnDepth : Table.Column row -> Int

How deep the column sits in the column tree. Top level is 0.

columnColumns

columnColumns : Table.Column row -> List (Table.Column row)

The columns nested under a group column.

columnParentId

columnParentId : Table.Column row -> Maybe String

The id of the group column this column sits under.

columnAccessor

columnAccessor : Table.Column row -> Maybe (row -> Table.Value.Value)

The accessor, when the column has one. Group and display columns have none.

columnSize

columnSize : Table.Config row -> Table.Column row -> Float

This column's size in pixels, clamped to its minimum and maximum.

columnMinSize

columnMinSize : Table.Config row -> Table.Column row -> Float

This column's minimum size in pixels.

columnMaxSize

columnMaxSize : Table.Config row -> Table.Column row -> Float

This column's maximum size in pixels.

allColumns

allColumns : Table.Config row -> List (Table.Column row)

Every column, group columns included, each group before its children.

leafColumns

leafColumns : Table.Config row -> List (Table.Column row)

Every leaf column, in definition order.

visibleLeafColumns

visibleLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)

The leaf columns a table renders: State.columnOrder applied, hidden columns dropped.

findColumn

findColumn : Table.Config row -> String -> Maybe (Table.Column row)

Find a column by id. Group columns are found too.

columnFlatColumns

columnFlatColumns : Table.Column row -> List (Table.Column row)

One column and every column below it, the column itself first.

columnLeafColumns

columnLeafColumns : Table.Column row -> List (Table.Column row)

The leaf columns below one column. A leaf column returns itself.

Headers

headerGroups

headerGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)

The header rows of a table, top row first.

footerGroups

footerGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)

The footer rows: the header rows bottom row first.

flatHeaders

flatHeaders : Table.Config row -> Table.State -> List (Table.Header row)

Every header of every header row.

leafHeaders

leafHeaders : Table.Config row -> Table.State -> List (Table.Header row)

The leaf headers reachable from the top header row.

getLeafHeaders

getLeafHeaders : Table.Header row -> List (Table.Header row)

The descendants of a header, deepest first, with the header itself last.

headerId

headerId : Table.Header row -> String

The header id. Placeholder headers get a compound id.

headerColumnId

headerColumnId : Table.Header row -> String

The id of the column this header renders.

headerColSpan

headerColSpan : Table.Header row -> Int

How many leaf columns this header spans.

headerRowSpan

headerRowSpan : Table.Header row -> Int

How many header rows this header spans. 0 means a header above already covers this cell.

headerDepth

headerDepth : Table.Header row -> Int

Which header row this header belongs to, counted from 1 at the top.

headerIndex

headerIndex : Table.Header row -> Int

The header's position in its header row.

headerIsPlaceholder

headerIsPlaceholder : Table.Header row -> Bool

Is this a filler header standing in for a column that has no group at this level?

headerPlaceholderId

headerPlaceholderId : Table.Header row -> Maybe String

How many placeholders for the same column came before this one.

headerSubHeaders

headerSubHeaders : Table.Header row -> List (Table.Header row)

The headers nested under this one.

Row models

The pipeline that turns your data into a row tree, the readers that walk one row, and the faceted values later stages sample from it.

Reading rows

rowId

rowId : Table.Row row -> String

The row id.

rowIndex

rowIndex : Table.Row row -> Int

The row's index among its siblings.

rowDepth

rowDepth : Table.Row row -> Int

How deep the row sits in the row tree. Root rows are 0.

rowOriginal

rowOriginal : Table.Row row -> row

The original datum this row was built from.

rowSubRows

rowSubRows : Table.Row row -> List (Table.Row row)

The row's children.

rowParentId

rowParentId : Table.Row row -> Maybe String

The id of the row's parent, when it has one.

rowOriginalSubRows

rowOriginalSubRows : Table.Row row -> List row

The raw children Config.getSubRows returned for this row.

rowGroupingColumnId

rowGroupingColumnId : Table.Row row -> Maybe String

The column a group row groups by, when the row is a group row.

rowGroupingValue

rowGroupingValue : Table.Row row -> Table.Value.Value

The value a group row groups by.

rowLeafRows

rowLeafRows : Table.Row row -> List (Table.Row row)

The leaf rows a group row was built from. Empty for ordinary rows.

rowAggregatedValues

rowAggregatedValues : Table.Row row -> Dict String Table.Value.Value

The aggregated values of a group row, keyed by column id.

getValue

getValue : Table.Config row -> Table.Row row -> String -> Table.Value.Value

Read one cell value. Unknown columns and columns without an accessor give Null.

getUniqueValues

getUniqueValues : Table.Config row -> Table.Row row -> String -> List Table.Value.Value

The values faceting and grouping use for one cell. A column with withGetUniqueValues decides them; otherwise the cell value is wrapped in a one-item list.

getLeafRows

getLeafRows : Table.Row row -> List (Table.Row row)

Every descendant of a row, depth first. The row itself is not included.

getParentRow

getParentRow : Table.RowModel row -> Table.Row row -> Maybe (Table.Row row)

The direct parent of a row, looked up in a row model.

getParentRows

getParentRows : Table.RowModel row -> Table.Row row -> List (Table.Row row)

The ancestors of a row, from the root down to its direct parent.

getAllCells

getAllCells : Table.Config row -> Table.State -> Table.Row row -> List Table.Cell

One cell per leaf column, in leaf column order. Hidden columns are included.

findRow

findRow : Table.RowModel row -> String -> Maybe (Table.Row row)

Look a row up by id.

maxSubRowDepth

maxSubRowDepth : Table.RowModel row -> Int

The deepest row depth in a row model, counting sub-rows and group rows. A flat model is 0; one level of sub-rows makes it 1. Useful for sizing indentation or the header checkbox of an expanding table.

The pipeline

rows

rows : Table.Config row -> Table.State -> Array row -> Table.RowModel row

The whole pipeline: core, filtered, grouped, sorted, expanded, paginated, in that order.

A manual flag on the config skips its stage and passes the row model through unchanged.

rowsFromList

rowsFromList : Table.Config row -> Table.State -> List row -> Table.RowModel row

The List form of rows.

coreRowModel

coreRowModel : Table.Config row -> Table.State -> Array row -> Table.RowModel row

The untouched row model: one row per datum, sub-rows resolved, ids assigned.

coreRowModelFromList

coreRowModelFromList : Table.Config row -> Table.State -> List row -> Table.RowModel row

The List form of coreRowModel.

filteredRowModel

filteredRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel row

Drop the rows that fail the column filters and the global filter. Config.manualFiltering skips this stage.

groupedRowModel

groupedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel row

Replace the rows with group rows. Config.manualGrouping skips this stage.

sortedRowModel

sortedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel row

Sort every level of the row tree. Config.manualSorting skips this stage.

expandedRowModel

expandedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel row

Flatten the expanded branches into the row list. Config.manualExpanding skips this stage.

paginatedRowModel

paginatedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel row

Keep only the rows of the current page. Config.manualPagination skips this stage.

Faceting

facetedUniqueValues

facetedUniqueValues : Table.Config row -> Table.State -> Table.RowModel row -> String -> List ( Table.Value.Value, Int )

Every distinct value of one column with the number of rows that carry it, in first-seen order. Pass the pre-filtered row model (usually the core row model); the count is taken over facetedRowModel, which applies every filter except this column's own. List cells contribute each item.

facetedMinMax

facetedMinMax : Table.Config row -> Table.State -> Table.RowModel row -> String -> Maybe ( Float, Float )

The smallest and largest Number value of one column, or Nothing when it has none. Pass the pre-filtered row model; like facetedUniqueValues it looks through facetedRowModel.

facetedRowModel

facetedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> String -> Table.RowModel row

The rows a column's facets are computed from: the pre-filtered rows with every active filter applied except that column's own, so a filter UI keeps showing the values the user could switch to.

Pass the row model you handed to filteredRowModel. Passing globalFacetKey as the column id excludes the global filter instead of a column filter.

globalFacetKey

globalFacetKey : String

The column id that stands for the global filter's own facet context, "__global__". Passing it to facetedRowModel, facetedUniqueValues or facetedMinMax aggregates across every globally filterable column.

Filtering

Column filters narrow a row model down to the rows that match; the global filter runs the same comparison across every column that allows it. Every reader that has to guess something from the data (an 'auto' filter function, for instance) takes a RowModel row to sample, exactly like TanStack, which samples the core or filtered row model for the same job.

Column filter state

getCanFilter

getCanFilter : Table.Config row -> String -> Bool

Can this column carry a column filter? It needs an accessor, and neither the column nor Config.enableColumnFilters nor Config.enableFilters may have switched filtering off.

The filtered row model does not consult this: a State.columnFilters entry for a column that answers False is still applied, matching TanStack.

getIsFiltered

getIsFiltered : Table.State -> String -> Bool

Does State.columnFilters hold an entry for this column?

getFilterValue

getFilterValue : Table.State -> String -> Maybe Table.Value.Value

This column's current filter value, when it has one.

getFilterIndex

getFilterIndex : Table.State -> String -> Int

This column's position in State.columnFilters, or -1.

getFilterFn

getFilterFn : Table.Config row -> Table.RowModel row -> String -> Maybe Table.FilterFn.FilterFn

The filter function a column filters with: the one set with withFilterFn, or the automatic choice. Nothing when the column does not exist.

Pass the core row model; the automatic choice samples it.

getAutoFilterFn

getAutoFilterFn : Table.Config row -> Table.RowModel row -> String -> Table.FilterFn.FilterFn

The filter function 'auto' picks for a column, from the type of its first non-null value: includesString for strings, inNumberRange for numbers, equals for booleans, arrIncludes for lists, inDateRange for dates, and weakEquals when every value is Null.

shouldAutoRemoveFilter

shouldAutoRemoveFilter : Maybe Table.FilterFn.FilterFn -> Table.Value.Value -> Bool

Should a filter value be dropped from state instead of stored? A filter function's own rule wins; without one, Null and the empty string are dropped.

setColumnFilter

setColumnFilter : Table.Config row -> Table.RowModel row -> String -> Table.Value.Value -> Table.State -> Table.State

Set one column's filter value: replaced in place when the column already has one, appended otherwise, and removed when shouldAutoRemoveFilter says the value is blank.

Pass the core row model: a column without an explicit filter function picks its automatic one from the first values, and that choice decides the auto-remove rule.

setColumnFilters

setColumnFilters : Table.Config row -> Table.RowModel row -> List Table.ColumnFilter -> Table.State -> Table.State

Replace State.columnFilters wholesale, dropping the entries of known columns whose value should auto-remove. Pass the core row model, as for setColumnFilter.

resetColumnFilters

resetColumnFilters : Table.State -> Table.State

Clear every column filter.

Global filter state

getCanGlobalFilter

getCanGlobalFilter : Table.Config row -> Table.RowModel row -> String -> Bool

Does the global filter run against this column? It needs an accessor, Config.enableGlobalFilter and Config.enableFilters have to be on, the column must not opt out, and Config.getColumnCanGlobalFilter (whose default keeps a column only when its first non-null value is a string or a number) has to agree.

getGlobalFilterFn

getGlobalFilterFn : Table.Config row -> Table.FilterFn.FilterFn

The filter function the global filter uses: Config.globalFilterFn, or globalAutoFilterFn.

globalAutoFilterFn

globalAutoFilterFn : Table.FilterFn.FilterFn

The global filter's automatic function: Table.FilterFn.includesString.

setGlobalFilter

setGlobalFilter : Table.Value.Value -> Table.State -> Table.State

Set the global filter value.

resetGlobalFilter

resetGlobalFilter : Table.State -> Table.State

Clear the global filter.

Sorting

One or more columns order the rows; withSortDescFirst, withInvertSorting, and withSortUndefined tune how a single column compares.

Sort direction

SortDir

type alias SortDir =
    Table.SortDir

A sort direction.

sortAsc

sortAsc : Table.SortDir

Ascending.

sortDesc

sortDesc : Table.SortDir

Descending.

Sorting state

getCanSort

getCanSort : Table.Config row -> String -> Bool

Can this column be sorted? It needs an accessor and both the column and Config.enableSorting have to allow it.

getCanMultiSort

getCanMultiSort : Table.Config row -> String -> Bool

Can this column join a multi-sort? The column's own setting wins over Config.enableMultiSort.

getIsSorted

getIsSorted : Table.State -> String -> Maybe Table.SortDir

This column's sort direction, or Nothing when it is not sorted.

getSortIndex

getSortIndex : Table.State -> String -> Int

This column's position in State.sorting, or -1.

getAutoSortFn

getAutoSortFn : Table.Config row -> Table.RowModel row -> String -> Table.SortFn.SortFn

The sort function 'auto' picks for a column. The first ten rows of the row model are sampled: a date gives datetime, a string holding digits gives alphanumeric, any other string gives text, and anything else gives basic.

Pass the filtered row model, which is what TanStack samples.

getSortFn

getSortFn : Table.Config row -> Table.RowModel row -> String -> Table.SortFn.SortFn

The sort function a column sorts with: the one set with withSortFn, or the automatic choice. A column set up with withCustomSort compares whole rows and has no SortFn, so this reports its automatic choice while the row model uses the custom comparison.

getAutoSortDir

getAutoSortDir : Table.Config row -> Table.RowModel row -> String -> Table.SortDir

The direction a column starts sorting in when nothing says otherwise: the first non-null value among the first ten rows decides, strings ascending and everything else descending.

getFirstSortDir

getFirstSortDir : Table.Config row -> Table.RowModel row -> String -> Table.SortDir

The direction the first click on a column sorts in: the column's withSortDescFirst wins, then Config.sortDescFirst, then getAutoSortDir.

getNextSortingOrder

getNextSortingOrder : Table.Config row -> Table.RowModel row -> Table.State -> String -> Bool -> Maybe Table.SortDir

The next step of a column's sort cycle. Nothing means the next step removes the sort, which Config.enableSortingRemoval and (in a multi-sort) Config.enableMultiRemove can forbid.

toggleSort

toggleSort : Table.Config row -> Table.RowModel row -> String -> { desc : Maybe Bool, multi : Bool } -> Table.State -> Table.State

Step a column's sort: add it, replace the sort with it, flip its direction, or remove it.

desc = Just d sets the direction outright instead of stepping the cycle. multi = True asks to add to the existing sort rather than replace it, which happens only when getCanMultiSort allows it; Config.maxMultiSortColCount caps how many columns a multi-sort keeps.

The row model is the pre-sorted one (the grouped row model, or the core row model when nothing is grouped or filtered): the first sort direction of a column without sortDescFirst depends on its values.

setSorting

setSorting : List Table.SortColumn -> Table.State -> Table.State

Replace State.sorting.

clearSorting

clearSorting : String -> Table.State -> Table.State

Remove one column from State.sorting, leaving the others in order.

resetSorting

resetSorting : Table.State -> Table.State

Clear every sort.

Pagination

Slices the pre-pagination row model into pages; Config.pageCount and Config.rowCount stand in for a server-side count when the table is not paginating in memory.

Pagination state

prePaginationRowModel

prePaginationRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel row

The row model pagination slices, which is the expanded row model. The row counts and page counts below all read it.

rowsInDisplayOrder

rowsInDisplayOrder : Table.Config row -> Table.State -> Table.RowModel row -> List (Table.Row row)

The rows a caller renders, in order. With Config.paginateExpandedRows = False the expanded descendants that the pre-pagination row model does not carry are inserted here.

displayIndex

displayIndex : Table.Config row -> Table.State -> Table.RowModel row -> Table.Row row -> Int

A row's zero-based position in rowsInDisplayOrder, or -1 when it is not there.

setPage

setPage : Table.Config row -> Int -> Table.State -> Table.State

Go to a page, clamped to [0, Config.pageCount - 1] when Config.pageCount is set. A Config.pageCount of Just -1 means the count is unknown and clamps nothing.

setPageSize

setPageSize : Int -> Table.State -> Table.State

Change the page size, at least 1. The page index moves so the row that was at the top of the page stays in view.

setPagination

setPagination : Table.Pagination -> Table.State -> Table.State

Replace State.pagination.

resetPageIndex

resetPageIndex : Table.Config row -> Table.State -> Table.State

Back to page 0.

resetPageSize

resetPageSize : Table.State -> Table.State

Back to a page size of 10.

resetPagination

resetPagination : Table.State -> Table.State

Back to page 0 with a page size of 10.

getPageCount

getPageCount : Table.Config row -> Table.State -> Table.RowModel row -> Int

How many pages there are: Config.pageCount when it is set, otherwise getRowCount divided by the page size, rounded up.

getPageOptions

getPageOptions : Table.Config row -> Table.State -> Table.RowModel row -> List Int

Every page index, [0, 1, ...].

getRowCount

getRowCount : Table.Config row -> Table.RowModel row -> Int

How many rows pagination is slicing: Config.rowCount when it is set, otherwise the rows of the pre-pagination row model.

getCanPreviousPage

getCanPreviousPage : Table.State -> Bool

Is there a page before this one?

getCanNextPage

getCanNextPage : Table.Config row -> Table.State -> Table.RowModel row -> Bool

Is there a page after this one? An unknown page count always says yes.

getCanLastPage

getCanLastPage : Table.Config row -> Table.State -> Table.RowModel row -> Bool

Is there a known last page after this one?

previousPage

previousPage : Table.Config row -> Table.State -> Table.State

Go back one page, clamped at 0.

nextPage

nextPage : Table.Config row -> Table.State -> Table.State

Go forward one page.

firstPage

firstPage : Table.Config row -> Table.State -> Table.State

Go to page 0.

lastPage

lastPage : Table.Config row -> Table.State -> Table.RowModel row -> Table.State

Go to the last page. A no-op when the page count is unknown or empty.

unlimitedPageSize

unlimitedPageSize : Int

The page size that puts every row on one page. Elm has no Infinity for Int, so this is Number.MAX_SAFE_INTEGER where TanStack writes Infinity.

Grouping and aggregation

The grouped row model replaces the rows with one group row per distinct value of every column in State.grouping, recursively, and rolls up every other column with an AggregationFn.

Group rows carry rowGroupingColumnId, rowGroupingValue, rowLeafRows, and rowAggregatedValues, and their ids are "columnId:groupingValue" joined to the parent group's id with >.

Grouping and expanding configuration

withRowCanExpand

withRowCanExpand : (Table.Row row -> Bool) -> Table.Config row -> Table.Config row

Set a per-row override for "can this row expand?", TanStack's getRowCanExpand. It wins over Config.enableExpanding and over the "has sub-rows" rule.

withIsRowExpanded

withIsRowExpanded : (Table.Row row -> Bool) -> Table.Config row -> Table.Config row

Set a per-row override for "is this row expanded?", TanStack's getIsRowExpanded. It wins over State.expanded outright.

withMaxAggregationDepth

withMaxAggregationDepth : Int -> Table.Column row -> Table.Column row

How far below an aggregated row its aggregation looks for values. 0, the default, aggregates the rows themselves; 1 aggregates their children. TanStack's maxAggregationDepth.

Grouping state

getCanGroup

getCanGroup : Table.Config row -> String -> Bool

Can this column be grouped? Grouping has to be enabled on the table and on the column, and the column needs either an accessor or a withGetGroupingValue.

getIsGrouped

getIsGrouped : Table.State -> String -> Bool

Is this column in State.grouping?

getGroupedIndex

getGroupedIndex : Table.State -> String -> Int

Where this column sits in State.grouping, or -1.

toggleGrouping

toggleGrouping : String -> Table.State -> Table.State

Add this column to State.grouping, or drop it and keep the rest in order. TanStack's column_toggleGrouping does not check getCanGroup either; its click handler does.

setGrouping

setGrouping : List String -> Table.State -> Table.State

Replace State.grouping.

resetGrouping

resetGrouping : Table.State -> Table.State

Empty State.grouping.

rowIsGrouped

rowIsGrouped : Table.Row row -> Bool

Was this row built by the grouped row model?

rowGroupingValueFor

rowGroupingValueFor : Table.Config row -> Table.Row row -> String -> Table.Value.Value

The value this row groups by for one column: withGetGroupingValue when the column has one, the cell value otherwise.

cellIsGrouped

cellIsGrouped : Table.State -> Table.Row row -> String -> Bool

Is this the cell of the column its group row groups by? Cell carries its row and column ids, so this takes the row and the column id.

cellIsPlaceholder

cellIsPlaceholder : Table.State -> Table.Row row -> String -> Bool

Is this the cell of a grouped column that is not this row's own grouping column? Those cells render as placeholders.

preGroupedRowModel

preGroupedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel row

The row model grouping runs on: the filtered one.

Aggregation

getAutoAggregationFn

getAutoAggregationFn : Table.Config row -> Table.RowModel row -> String -> Maybe Table.AggregationFn.AggregationFn

The aggregation function a column with no withAggregationFn gets: sum for a numeric column, extent for a date column, none for anything else. The kind is read off the first flat row of the row model handed in.

getAggregationFn

getAggregationFn : Table.Config row -> Table.RowModel row -> String -> Maybe Table.AggregationFn.AggregationFn

The aggregation function of a column: its own, or the automatic one.

aggregationValue

aggregationValue : Table.Config row -> Table.RowModel row -> String -> Table.Value.Value

Aggregate one column over the rows of a row model, at the column's own withMaxAggregationDepth. TanStack's column.getAggregationValue().

aggregationValueOf

aggregationValueOf : Table.Config row -> Table.RowModel row -> String -> { maxDepth : Int, rows : List (Table.Row row) } -> Table.Value.Value

Aggregate one column over a chosen row list and depth, TanStack's column.getAggregationValue({ rows, maxDepth }). Use it for footers and summaries that the grouped row model does not produce, for example the total of a column over every filtered row. The row model is only there to resolve an automatic aggregation function from the column's values; pass the core or filtered model. maxDepth stops the descent into sub-rows; Nothing means the column's own maxAggregationDepth.

cellIsAggregated

cellIsAggregated : Table.Config row -> Table.RowModel row -> Table.State -> Table.Row row -> String -> Bool

Is this cell an aggregated one? True on a group row for a column that is neither the row's own grouping column nor itself grouped, and that has an aggregation function.

Expanding

Splices the sub-rows of expanded rows back into the row list, according to State.expanded.

Expanded state

preExpandedRowModel

preExpandedRowModel : Table.Config row -> Table.State -> Table.RowModel row -> Table.RowModel row

The row model expansion runs on: the sorted one.

getCanExpand

getCanExpand : Table.Config row -> Table.Row row -> Bool

Can this row expand? withRowCanExpand wins, otherwise Config.enableExpanding has to be on and the row needs sub-rows.

getIsExpanded

getIsExpanded : Table.Config row -> Table.State -> Table.Row row -> Bool

Is this row expanded? withIsRowExpanded wins, otherwise State.expanded decides.

getIsAllParentsExpanded

getIsAllParentsExpanded : Table.Config row -> Table.State -> Table.RowModel row -> Table.Row row -> Bool

Is every ancestor of this row expanded? The row itself is not considered.

getCanSomeRowsExpand

getCanSomeRowsExpand : Table.Config row -> Table.RowModel row -> Bool

Can any row of this row model expand? TanStack reads the pre-pagination row model here, so controls can reflect rows that are not on this page.

getIsSomeRowsExpanded

getIsSomeRowsExpanded : Table.State -> Bool

Is any row expanded? True for expandAll and for a non-empty expandedIds set; it does not check that the ids still exist in the data, which is what TanStack's getIsSomeRowsExpanded does too.

getIsAllRowsExpanded

getIsAllRowsExpanded : Table.Config row -> Table.State -> Table.RowModel row -> Bool

Is every expandable row of this row model expanded? An empty State.expanded is False, and so is one whose ids match no expandable row.

getExpandedDepth

getExpandedDepth : Table.Config row -> Table.State -> Table.RowModel row -> Int

The deepest expanded row id, counted in .-separated segments.

toggleExpanded

toggleExpanded : Table.Config row -> Table.RowModel row -> Table.Row row -> Maybe Bool -> Table.State -> Table.State

Expand or collapse one row. Nothing toggles it. Expanding a row that cannot expand and any request that matches the current state are no-ops; collapsing always applies, so a stale id can be cleaned up.

The row model materialises expandAll into the ids of the rows that can expand before the change lands. Pass the pre-expanded row model (the sorted row model, or whatever preExpandedRowModel gives you), so group rows are included when grouping is on.

toggleAllRowsExpanded

toggleAllRowsExpanded : Table.Config row -> Table.RowModel row -> Maybe Bool -> Table.State -> Table.State

Expand or collapse every row. Nothing toggles on getIsAllRowsExpanded.

setExpanded

setExpanded : Table.Expanded -> Table.State -> Table.State

Replace State.expanded.

resetExpanded

resetExpanded : Table.State -> Table.State

Collapse everything: State.expanded back to no ids.

Row selection

Row selection propagates to sub-rows and reports isSomeSelected and isAllSelected per parent. Every transition is ... -> State -> State so it pipes, and every query takes the Config and the State first, then the row model or column it is about.

Selection types

SubRowSelection

type alias SubRowSelection =
    Table.SubRowSelection

How much of a parent row's sub-tree is selected.

SelectOptions

type alias SelectOptions =
    Table.SelectOptions

The options of a selection toggle. selectChildren also writes the row's sub-tree; deselectParents drops the ancestors of a row that is being deselected.

noSubRowsSelected

noSubRowsSelected : Table.SubRowSelection

No selectable descendant of this row is selected.

someSubRowsSelected

someSubRowsSelected : Table.SubRowSelection

Some, but not all, selectable descendants are selected.

allSubRowsSelected

allSubRowsSelected : Table.SubRowSelection

Every selectable descendant is selected.

defaultSelectOptions

defaultSelectOptions : Table.SelectOptions

selectChildren on, deselectParents off: TanStack's defaults.

These are abstract for the same reason as the types above, so they come with one function per variant.

Selection state

toggleRowSelected

toggleRowSelected : Table.Config row -> Table.RowModel row -> Table.Row row -> Maybe Bool -> Table.State -> Table.State

Select or deselect one row; Nothing flips it. Sub-rows follow along. The row model is only read for the parent chain, so the core row model is the usual argument.

toggleRowSelectedWith

toggleRowSelectedWith : Table.Config row -> Table.SelectOptions -> Table.RowModel row -> Table.Row row -> Maybe Bool -> Table.State -> Table.State

toggleAllRowsSelected

toggleAllRowsSelected : Table.Config row -> Table.RowModel row -> Maybe Bool -> Table.State -> Table.State

Select or deselect every row of the given model; Nothing flips on the current all-selected state. Pass the filtered row model, which is what TanStack's pre-grouped model is.

toggleAllPageRowsSelected

toggleAllPageRowsSelected : Table.Config row -> Table.RowModel row -> Maybe Bool -> Table.State -> Table.State

Select or deselect every row of the current page. Pass the paginated row model.

deselectAllRows

deselectAllRows : Table.State -> Table.State

Clear the selection, ids of rows that cannot be selected included. This is TanStack's deselectAll option.

setRowSelection

setRowSelection : Set String -> Table.State -> Table.State

Replace the selection.

resetRowSelection

resetRowSelection : Table.State -> Table.State

Clear the selection.

selectRange

selectRange : Table.Config row -> Table.RowModel row -> String -> Table.Row row -> Bool -> Table.State -> Table.State

Select or deselect every row between an anchor id and this row, in display order. Pass the pre-pagination row model (the expanded row model): like TanStack's getRowsInDisplayOrder, the range ignores the current page and honours Config.paginateExpandedRows, so a shift-click can span pages. Falls back to an ordinary toggle when the range is not usable, which is what the shift-click handler does.

selectRangeWith

selectRangeWith : Table.Config row -> Table.SelectOptions -> Table.RowModel row -> String -> Table.Row row -> Bool -> Table.State -> Table.State

selectRange with explicit SelectOptions.

canSelectRange

canSelectRange : Table.Config row -> Table.State -> Table.RowModel row -> String -> Table.Row row -> Bool

Would a range from this anchor to this row be selected as a range? Both endpoints have to be in the display order of the pre-pagination row model and allow multi-selection.

getIsRowSelected

getIsRowSelected : Table.State -> Table.Row row -> Bool

Is this row selected?

getIsSomeRowsSelected

getIsSomeRowsSelected : Table.State -> Bool

Is anything selected at all?

getIsAllRowsSelected

getIsAllRowsSelected : Table.Config row -> Table.State -> Table.RowModel row -> Bool

Is every selectable row of the given model selected? Pass the filtered row model.

getIsAllPageRowsSelected

getIsAllPageRowsSelected : Table.Config row -> Table.State -> Table.RowModel row -> Bool

Is every selectable row of the current page selected?

getIsSomePageRowsSelected

getIsSomePageRowsSelected : Table.Config row -> Table.State -> Table.RowModel row -> Bool

Is any row of the current page selected, or partly selected?

getCanSelect

getCanSelect : Table.Config row -> Table.Row row -> Bool

Can this row be selected?

getCanSelectSubRows

getCanSelectSubRows : Table.Config row -> Table.Row row -> Bool

Can selecting this row select its sub-rows?

getCanMultiSelect

getCanMultiSelect : Table.Config row -> Table.Row row -> Bool

Can this row take part in a multi-row selection?

getIsSomeSelected

getIsSomeSelected : Table.Config row -> Table.State -> Table.Row row -> Bool

Is part, but not all, of this row's sub-tree selected?

getIsAllSubRowsSelected

getIsAllSubRowsSelected : Table.Config row -> Table.State -> Table.Row row -> Bool

Is this row's whole sub-tree selected?

subRowSelection

subRowSelection : Table.Config row -> Table.State -> Table.Row row -> Table.SubRowSelection

How much of this row's sub-tree is selected.

selectedRowIds

selectedRowIds : Table.State -> List String

The selected row ids.

selectedRowModel

selectedRowModel : Table.State -> Table.RowModel row -> Table.RowModel row

Keep only the selected rows of a row model. Selected descendants of unselected parents stay in flatRows and rowsById but not in rows, exactly like TanStack's selectRowsFn. TanStack's three selected row models are this function over the core, the filtered, and the sorted row model.

Pinning

Column pinning returns left, center, and right leaf column lists; row pinning does the same for rows. Neither one touches the DOM.

Pinning types

ColumnPinPosition

type alias ColumnPinPosition =
    Table.ColumnPinPosition

Where a column is pinned: pinnedLeft, pinnedRight, or columnUnpinned. TanStack calls these 'start', 'end', and false.

ColumnRegion

type alias ColumnRegion =
    Table.ColumnRegion

Which slice of the visible leaf columns a query is about. allColumnsRegion is TanStack's absent position argument and means the whole visible list in table order.

RowPinPosition

type alias RowPinPosition =
    Table.RowPinPosition

Where a row is pinned: pinnedTop, pinnedBottom, or rowUnpinned.

PinRowOptions

type alias PinRowOptions =
    Table.PinRowOptions

The options of pinRowWith: pin the row's leaf rows and its ancestors along with it.

PinnedRowsSource

type alias PinnedRowsSource row =
    Table.PinnedRowsSource row

The two row models the pinned row lists read from. With Config.keepPinnedRows on, a pinned row is taken from prePaginated even when it is off the current page; with it off, only current is searched.

PinnedColumns

type alias PinnedColumns row =
    Table.PinnedColumns row

The three visible column slices of a pinned table.

pinnedLeft

pinnedLeft : Table.ColumnPinPosition

Pinned to the left edge. TanStack's 'start'.

pinnedRight

pinnedRight : Table.ColumnPinPosition

Pinned to the right edge. TanStack's 'end'.

columnUnpinned

columnUnpinned : Table.ColumnPinPosition

Not pinned. Passing this to pinColumn unpins the column.

allColumnsRegion

allColumnsRegion : Table.ColumnRegion

Every visible leaf column, in table order, with no pin partitioning.

leftColumnsRegion

leftColumnsRegion : Table.ColumnRegion

The columns pinned to the left edge.

centerColumnsRegion

centerColumnsRegion : Table.ColumnRegion

The columns that are not pinned.

rightColumnsRegion

rightColumnsRegion : Table.ColumnRegion

The columns pinned to the right edge.

pinnedTop

pinnedTop : Table.RowPinPosition

Pinned to the top of the table.

pinnedBottom

pinnedBottom : Table.RowPinPosition

Pinned to the bottom of the table.

rowUnpinned

rowUnpinned : Table.RowPinPosition

Not pinned. Passing this to pinRow unpins the row.

defaultPinRowOptions

defaultPinRowOptions : Table.PinRowOptions

Pin the row alone, without its leaf rows or its ancestors.

These are abstract for the same reason as the types above, so they come with one function per variant.

Column pinning

pinColumn

pinColumn : Table.ColumnPinPosition -> Table.Column row -> Table.State -> Table.State

Pin one column to an edge, or unpin it with columnUnpinned. A group column pins every leaf below it.

setColumnPinning

setColumnPinning : Table.ColumnPinning -> Table.State -> Table.State

Replace the column pinning state.

resetColumnPinning

resetColumnPinning : Table.State -> Table.State

Unpin every column.

columnCanPin

columnCanPin : Table.Config row -> Table.Column row -> Bool

Can this column be pinned? At least one leaf below it has to allow it and Config.enableColumnPinning has to be on.

columnIsPinned

columnIsPinned : Table.State -> Table.Column row -> Table.ColumnPinPosition

Where is this column pinned? A group column reports the region of its first pinned leaf, left before right.

columnPinnedIndex

columnPinnedIndex : Table.State -> Table.Column row -> Int

The column's position inside its pinned region. Unpinned columns give 0, matching TanStack.

isSomeColumnsPinned

isSomeColumnsPinned : Table.State -> Bool

Is any column pinned to either edge?

isSomeColumnsPinnedLeft

isSomeColumnsPinnedLeft : Table.State -> Bool

Is any column pinned to the left edge?

isSomeColumnsPinnedRight

isSomeColumnsPinnedRight : Table.State -> Bool

Is any column pinned to the right edge?

leftLeafColumns

leftLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)

The leaf columns pinned left, in pinning-state order.

centerLeafColumns

centerLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)

The leaf columns that are not pinned, in table order.

rightLeafColumns

rightLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)

The leaf columns pinned right, in pinning-state order.

pinnedLeafColumns

pinnedLeafColumns : Table.Config row -> Table.State -> Table.ColumnRegion -> List (Table.Column row)

The leaf columns of one region, hidden columns included.

leftVisibleLeafColumns

leftVisibleLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)

The visible leaf columns pinned left.

centerVisibleLeafColumns

centerVisibleLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)

The visible leaf columns that are not pinned.

rightVisibleLeafColumns

rightVisibleLeafColumns : Table.Config row -> Table.State -> List (Table.Column row)

The visible leaf columns pinned right.

pinnedVisibleLeafColumns

pinnedVisibleLeafColumns : Table.Config row -> Table.State -> Table.ColumnRegion -> List (Table.Column row)

The visible leaf columns of one region. allColumnsRegion gives visibleLeafColumns unchanged.

pinnedColumns

pinnedColumns : Table.Config row -> Table.State -> Table.PinnedColumns row

The three visible column slices at once, in render order.

leftHeaderGroups

leftHeaderGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)

The header rows of the left-pinned columns.

centerHeaderGroups

centerHeaderGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)

The header rows of the unpinned columns.

rightHeaderGroups

rightHeaderGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)

The header rows of the right-pinned columns.

leftFooterGroups

leftFooterGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)

The footer rows of the left-pinned columns.

centerFooterGroups

centerFooterGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)

The footer rows of the unpinned columns.

rightFooterGroups

rightFooterGroups : Table.Config row -> Table.State -> List (Table.HeaderGroup row)

The footer rows of the right-pinned columns.

leftFlatHeaders

leftFlatHeaders : Table.Config row -> Table.State -> List (Table.Header row)

Every header of the left-pinned header rows.

centerFlatHeaders

centerFlatHeaders : Table.Config row -> Table.State -> List (Table.Header row)

Every header of the center header rows.

rightFlatHeaders

rightFlatHeaders : Table.Config row -> Table.State -> List (Table.Header row)

Every header of the right-pinned header rows.

leftLeafHeaders

leftLeafHeaders : Table.Config row -> Table.State -> List (Table.Header row)

The left-pinned headers that have no sub-headers.

centerLeafHeaders

centerLeafHeaders : Table.Config row -> Table.State -> List (Table.Header row)

The center headers that have no sub-headers.

rightLeafHeaders

rightLeafHeaders : Table.Config row -> Table.State -> List (Table.Header row)

The right-pinned headers that have no sub-headers.

leftVisibleCells

leftVisibleCells : Table.Config row -> Table.State -> Table.Row row -> List Table.Cell

The visible cells of one row pinned left, in pinning-state order.

centerVisibleCells

centerVisibleCells : Table.Config row -> Table.State -> Table.Row row -> List Table.Cell

The visible cells of one row whose column is not pinned.

rightVisibleCells

rightVisibleCells : Table.Config row -> Table.State -> Table.Row row -> List Table.Cell

The visible cells of one row pinned right, in pinning-state order.

Row pinning

pinRow

pinRow : Table.RowPinPosition -> Table.Row row -> Table.State -> Table.State

Pin one row to an edge, or unpin it with rowUnpinned. Pinning removes the row id from the other edge first, so a row is never in both lists. Whether pinned rows are drawn from the whole data set or only the current page is Config.keepPinnedRows, read by topRows and bottomRows. Use pinRowWith to pin a row's parents or children along with it.

pinRowWith

pinRowWith : Table.RowPinPosition -> Table.PinRowOptions -> Table.RowModel row -> Table.Row row -> Table.State -> Table.State

pinRow with the leaf rows or the ancestors of the row pinned along with it. The row model is where the ancestors are looked up.

setRowPinning

setRowPinning : Table.RowPinning -> Table.State -> Table.State

Replace the row pinning state.

resetRowPinning

resetRowPinning : Table.State -> Table.State

Unpin every row.

getIsRowPinned

getIsRowPinned : Table.State -> Table.Row row -> Table.RowPinPosition

Where is this row pinned?

getRowPinnedIndex

getRowPinnedIndex : Table.Config row -> Table.State -> Table.PinnedRowsSource row -> Table.Row row -> Int

The row's position among the pinned rows that are actually shown, or -1 when it is not pinned.

getCanPinRow

getCanPinRow : Table.Config row -> Table.Row row -> Bool

Can this row be pinned?

isSomeRowsPinned

isSomeRowsPinned : Table.State -> Bool

Is any row pinned at either edge?

isSomeRowsPinnedTop

isSomeRowsPinnedTop : Table.State -> Bool

Is any row pinned to the top?

isSomeRowsPinnedBottom

isSomeRowsPinnedBottom : Table.State -> Bool

Is any row pinned to the bottom?

topRows

topRows : Table.Config row -> Table.State -> Table.PinnedRowsSource row -> List (Table.Row row)

The rows pinned to the top, in pinning-state order.

bottomRows

bottomRows : Table.Config row -> Table.State -> Table.PinnedRowsSource row -> List (Table.Row row)

The rows pinned to the bottom, in pinning-state order.

centerRows

centerRows : Table.State -> Table.RowModel row -> List (Table.Row row)

The rows of the current page that are not pinned.

Column ordering, visibility and sizing

Which columns render, in what order, and how wide each one is.

Column visibility

columnIsVisible

columnIsVisible : Table.State -> Table.Column row -> Bool

Is this column visible? A group column is visible when any leaf below it is.

columnCanHide

columnCanHide : Table.Config row -> Table.Column row -> Bool

Can this column be hidden? Both the column flag and Config.enableHiding have to allow it.

toggleColumnVisibility

toggleColumnVisibility : Table.Config row -> Table.Column row -> Maybe Bool -> Table.State -> Table.State

Show or hide one column; Nothing flips it. A group column writes every hideable leaf below it, because visibility is keyed by leaf column id.

setColumnVisibility

setColumnVisibility : Dict String Bool -> Table.State -> Table.State

Replace the whole visibility map.

resetColumnVisibility

resetColumnVisibility : Table.State -> Table.State

Clear the visibility map, which shows every column again.

toggleAllColumnsVisible

toggleAllColumnsVisible : Table.Config row -> Maybe Bool -> Table.State -> Table.State

Show or hide every leaf column; Nothing flips the current state. Columns that cannot hide stay visible.

isAllColumnsVisible

isAllColumnsVisible : Table.Config row -> Table.State -> Bool

Is every leaf column visible?

isSomeColumnsVisible

isSomeColumnsVisible : Table.Config row -> Table.State -> Bool

Is at least one leaf column visible?

visibleFlatColumns

visibleFlatColumns : Table.Config row -> Table.State -> List (Table.Column row)

Every column of the table, group columns included, minus the hidden ones.

visibleCells

visibleCells : Table.Config row -> Table.State -> Table.Row row -> List Table.Cell

The cells of one row whose column is visible: left-pinned first, then the unpinned cells in table order, then the right-pinned ones.

visibleCellsByColumnId

visibleCellsByColumnId : Table.Config row -> Table.State -> Table.Row row -> Dict String Table.Cell

The visible cells of one row keyed by column id.

Column order

setColumnOrder

setColumnOrder : List String -> Table.State -> Table.State

Replace State.columnOrder.

resetColumnOrder

resetColumnOrder : Table.State -> Table.State

Drop State.columnOrder, restoring definition order.

orderColumns

orderColumns : Table.Config row -> Table.State -> List (Table.Column row) -> List (Table.Column row)

Put a column list in table order: State.columnOrder first, unlisted columns behind the listed ones, then the grouped-column rules.

orderGroupedColumns

orderGroupedColumns : Table.Config row -> Table.State -> List (Table.Column row) -> List (Table.Column row)

Apply Config.groupedColumnMode to a leaf column list: move the grouped columns to the front, remove them, or leave the list alone.

columnIndex

columnIndex : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> Int

Where this column sits in one region of the visible leaf columns, or -1 when it is not in that region.

columnIsFirst

columnIsFirst : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> Bool

Is this the first visible column of the region?

columnIsLast

columnIsLast : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> Bool

Is this the last visible column of the region?

Column sizing

getColumnSize

getColumnSize : Table.Config row -> Table.State -> Table.Column row -> Float

The rendered width of a column: the committed size from State.columnSizing when there is one, otherwise the column's own size and then the configured default, clamped between minSize and maxSize.

getColumnStart

getColumnStart : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> Float

How far from the start of its region a column begins.

getColumnAfter

getColumnAfter : Table.Config row -> Table.State -> Table.ColumnRegion -> Table.Column row -> Float

How far from the end of its region a column ends.

setColumnSize

setColumnSize : String -> Float -> Table.State -> Table.State

Commit one column's size.

setColumnSizing

setColumnSizing : Dict String Float -> Table.State -> Table.State

Replace the whole sizing map.

resetColumnSize

resetColumnSize : String -> Table.State -> Table.State

Drop one column's committed size, leaving the other columns alone.

resetColumnSizing

resetColumnSizing : Table.State -> Table.State

Drop every committed size.

getHeaderSize

getHeaderSize : Table.Config row -> Table.State -> Table.Header row -> Float

The width of a header: its column's size for a leaf header, the sum of the sub-header widths for a parent header.

getHeaderStart

getHeaderStart : Table.Config row -> Table.State -> List (Table.Header row) -> Table.Header row -> Float

How far from the start of its header row a header begins. Pass the headers of the row the header belongs to.

totalSize

totalSize : Table.Config row -> Table.State -> Float

The width of the whole table: the sum of the top header row.

leftTotalSize

leftTotalSize : Table.Config row -> Table.State -> Float

The width of the left-pinned region.

centerTotalSize

centerTotalSize : Table.Config row -> Table.State -> Float

The width of the unpinned region.

rightTotalSize

rightTotalSize : Table.Config row -> Table.State -> Float

The width of the right-pinned region.

Cell spanning and cell selection

Spans merge adjacent cells; cell selection tracks rectangular ranges, focus, and keyboard movement over the visible grid. Optional; ignore this section if your table does not need either.

Span index types

CellSpanIndex

type alias CellSpanIndex =
    Table.CellSpanIndex

The cell span index of the rows a caller renders. Build it with cellSpanIndex and read it with cellRowSpan, cellColSpan, and cellIsCovered.

RowSpanContext

type alias RowSpanContext row =
    Table.RowSpanContext row

What a withSpanRowsWhen predicate is given for each candidate row. The run is anchored: anchorRow is the row whose cell renders the merged content, and every later row of the run is tested against it.

Cell spanning

withCellSpanning

withCellSpanning : Bool -> Table.Config row -> Table.Config row

Allow or forbid cell spanning for the whole table. False makes every cell report a span of 1 and builds no span index.

withEnableCellSpanning

withEnableCellSpanning : Bool -> Table.Column row -> Table.Column row

Turn one column off for cell spanning even when the table allows it.

withSpanRows

withSpanRows : Table.Column row -> Table.Column row

Merge adjacent rows whose value for this column is equal into one vertically spanning cell. Null never merges under this comparison; use withSpanRowsWhen to opt in.

withSpanRowsWhen

withSpanRowsWhen : (Table.RowSpanContext row -> Bool) -> Table.Column row -> Table.Column row

Decide per candidate row whether it joins the vertical run anchored at anchorRow.

withSpanColumns

withSpanColumns : (Table.Row row -> Int) -> Table.Column row -> Table.Column row

Make this column's cell span that many columns in the given row, counted in render order. A span is clamped to the end of the cell's pinned region, so it never crosses the left, center, or right boundary.

spanAllColumns

spanAllColumns : Int

The stand-in for Infinity in a withSpanColumns callback: "the rest of my region".

columnCanSpan

columnCanSpan : Table.Config row -> Table.Column row -> Bool

Does this column take part in cell spanning? A column opting out wins over the table option.

cellSpanIndex

cellSpanIndex : Table.Config row -> Table.State -> Table.RowModel row -> Table.CellSpanIndex

Build the span index of the rows a caller renders. Pass the row model you render, which is normally paginatedRowModel; row pinning is read off the state.

cellSpanIndexRowIds

cellSpanIndexRowIds : Table.CellSpanIndex -> List String

The row ids the index was built from, in render order.

cellSpanIndexRowSpans

cellSpanIndexRowSpans : Table.CellSpanIndex -> Dict String (List Int)

The vertical runs per column id, indexed by render-order row position. Only columns with at least one run longer than one row appear; a missing column means every cell in it spans exactly one row.

cellRowSpan

cellRowSpan : Table.CellSpanIndex -> Table.Cell -> Int

How many rows this cell spans: 1 when it does not span, and 0 when a spanning cell above covers it. Never render a 0; skip the cell instead.

cellColSpan

cellColSpan : Table.CellSpanIndex -> Table.Cell -> Int

How many columns this cell spans: 1 when it does not span, and 0 when another cell's column span covers it.

cellIsCovered

cellIsCovered : Table.CellSpanIndex -> Table.Cell -> Bool

Does another cell's span cover this cell? Covered cells carry no content of their own and must not be rendered.

Cell selection types

CellSelectionRange

type alias CellSelectionRange =
    Table.CellSelectionRange

One rectangular cell selection, stored as its two defining corners. The anchor stays put while the focus corner moves during a shift-extend or a drag, so the pair carries more than a normalized rectangle would. Build one with cellRange.

CellSelectionOperation

type alias CellSelectionOperation =
    Table.CellSelectionOperation

How a range changes the selection the ranges before it produced.

CellSelectionMode

type alias CellSelectionMode =
    Table.CellSelectionMode

Whether a write replaces the selection, adds a rectangle, or subtracts one.

CellSelectionBounds

type alias CellSelectionBounds =
    Table.CellSelectionBounds

A range resolved into inclusive display-order indexes. Rows are positions in rowsInDisplayOrder; columns are positions in the visible leaf columns in render order.

CellSelectionEdges

type alias CellSelectionEdges =
    Table.CellSelectionEdges

Which sides of a selected cell sit on the outer boundary of the selection, for drawing a spreadsheet-style outline.

CellDirection

type alias CellDirection =
    Table.CellDirection

One step of keyboard navigation.

SelectionRows

type alias SelectionRows row =
    Table.SelectionRows row

The two row models cell selection reads: prePaginated fixes the display-order indexes a range resolves against, so a range spans pages, and current is the page a caller renders, which bounds keyboard navigation and cell spanning. Without pagination both are the same model.

includeCells

includeCells : Table.CellSelectionOperation

A range that adds its rectangle to the selection.

excludeCells

excludeCells : Table.CellSelectionOperation

A range that subtracts its rectangle from the selection.

replaceSelection

replaceSelection : Table.CellSelectionMode

Replace the whole selection with this rectangle.

includeSelection

includeSelection : Table.CellSelectionMode

Add this rectangle alongside the existing ranges.

excludeSelection

excludeSelection : Table.CellSelectionMode

Subtract this rectangle from the existing ranges.

cellUp

cellUp : Table.CellDirection

Move or extend one row up.

cellDown

cellDown : Table.CellDirection

Move or extend one row down.

cellLeft

cellLeft : Table.CellDirection

Move or extend one column left.

cellRight

cellRight : Table.CellDirection

Move or extend one column right.

Cell selection options

withCellSelection

withCellSelection : Bool -> Table.Config row -> Table.Config row

Allow or forbid cell selection for the whole table.

withCellSelectionWhen

withCellSelectionWhen : (Table.Cell -> Bool) -> Table.Config row -> Table.Config row

Decide per cell whether it can be selected. The predicate replaces the boolean, exactly like TanStack's enableCellSelection in its function form.

withCellRangeSelection

withCellRangeSelection : Bool -> Table.Config row -> Table.Config row

Allow or forbid extending a cell selection into a range, which is what shift-click and drag do.

withMultiCellRangeSelection

withMultiCellRangeSelection : Bool -> Table.Config row -> Table.Config row

Allow or forbid adding and subtracting further rectangles, which is what ctrl-click and meta-click do.

withEnableCellSelection

withEnableCellSelection : Bool -> Table.Column row -> Table.Column row

Allow or forbid selecting the cells of one column.

Cell selection transitions

cellRange

cellRange : String -> String -> String -> String -> Table.CellSelectionRange

A range from its two corners, taken as an inclusion: cellRange anchorRowId anchorColumnId focusRowId focusColumnId.

setCellSelection

setCellSelection : List Table.CellSelectionRange -> Table.State -> Table.State

Replace the whole cellSelection slice.

clearCellSelection

clearCellSelection : Table.State -> Table.State

Drop every range. This is TanStack's resetCellSelection(table, true); there is no separate resetCellSelection here because the feature default is the empty list.

selectCellRange

selectCellRange : Table.CellSelectionRange -> Table.State -> Table.State

Select a rectangle, replacing the selection.

selectCellRangeWith

selectCellRangeWith : Table.CellSelectionMode -> Table.CellSelectionRange -> Table.State -> Table.State

Select a rectangle with replace, include, or exclude semantics.

selectAllCells

selectAllCells : Table.Config row -> Table.SelectionRows row -> Table.State -> Table.State

Select every selectable cell as one range.

setFocusedCell

setFocusedCell : String -> String -> Table.State -> Table.State

Collapse the selection to a single cell at the given coordinates.

selectCell

selectCell : Table.Config row -> Table.Cell -> Table.State -> Table.State

Start a selection at one cell, replacing whatever was selected. This is the state half of the mousedown handler with no modifier key.

extendCellSelectionTo

extendCellSelectionTo : Table.Config row -> Table.Cell -> Table.State -> Table.State

Move the active range's focus corner to this cell, keeping its anchor and its operation. This is the state half of a shift-mousedown and of a drag's mouseenter. With no active range, or with withCellRangeSelection off, it selects the cell instead.

toggleCellSelection

toggleCellSelection : Table.Config row -> Table.SelectionRows row -> Table.Cell -> Table.State -> Table.State

Add a rectangle at this cell alongside the existing ranges, subtracting instead when the cell is already selected. This is the state half of a ctrl- or meta-mousedown. With withMultiCellRangeSelection off, it selects the cell instead.

moveCellSelection

moveCellSelection : Table.Config row -> Table.SelectionRows row -> Table.CellDirection -> Table.State -> Table.State

Move the selection one step, collapsing it to a single cell. Columns that cannot be selected are skipped over, and a merged cell is one stop. With nothing selected this selects the first selectable cell.

extendCellSelection

extendCellSelection : Table.Config row -> Table.SelectionRows row -> Table.CellDirection -> Table.State -> Table.State

Extend the active range one step, keeping its anchor fixed.

Cell selection queries

cellCanSelect

cellCanSelect : Table.Config row -> Table.Cell -> Bool

Can this cell currently be selected? A column opting out wins over the table option.

cellIsSelected

cellIsSelected : Table.Config row -> Table.State -> Table.SelectionRows row -> Table.Cell -> Bool

Does this cell fall inside the final positive selection?

cellIsFocused

cellIsFocused : Table.State -> Table.Cell -> Bool

Is this cell the active cell, the anchor of the most recent range? An exclusion's active cell is focused even though it is not selected.

cellTabIndex

cellTabIndex : Table.State -> Table.Cell -> Int

0 for the focused cell and -1 otherwise, for a roving tabindex.

cellSelectionEdges

cellSelectionEdges : Table.Config row -> Table.State -> Table.SelectionRows row -> Table.Cell -> Table.CellSelectionEdges

Which sides of this cell sit on the outer boundary of the selection. All four are False when the cell is not selected.

focusedCell

focusedCell : Table.Config row -> Table.State -> Table.SelectionRows row -> Maybe Table.Cell

The active cell: the anchor of the most recent range.

cellSelectionBounds

cellSelectionBounds : Table.Config row -> Table.State -> Table.SelectionRows row -> List Table.CellSelectionBounds

The final positive selection as disjoint, inclusive display-order index rectangles, after every include and exclude is applied. A range whose corners no longer resolve is omitted rather than clamped, so it contributes nothing while staying in state.

cellSelectionMergeBounds

cellSelectionMergeBounds : Table.Config row -> Table.State -> Table.SelectionRows row -> List Table.CellSelectionBounds

The merged-cell rectangles of the rendered rows, in the same index space. Selection rectangles grow to enclose these, so a merged cell is always entirely selected or entirely unselected.

cellSelectionColumnIndexes

cellSelectionColumnIndexes : Table.Config row -> Table.State -> Dict String Int

The render-order index of every visible column id.

selectedCellIds

selectedCellIds : Table.Config row -> Table.State -> Table.SelectionRows row -> List String

The unique ids of all selected cells, in row-major order. Cells another cell's span covers are skipped, so the ids match what renders.

selectedCellCount

selectedCellCount : Table.Config row -> Table.State -> Table.SelectionRows row -> Int

How many cells are selected. A merged cell counts once.

selectedCellRangesData

selectedCellRangesData : Table.Config row -> Table.State -> Table.SelectionRows row -> List (List (List Table.Value.Value))

Each final positive region's values as a row-major grid, indexed as region, then row, then column. Covered cells keep their values so the grid stays rectangular; serializing it is the caller's job.

cellSelectionRowIds

cellSelectionRowIds : Table.Config row -> Table.State -> Table.SelectionRows row -> List String

The ids of all rows the selection intersects.

cellSelectionColumnIds

cellSelectionColumnIds : Table.Config row -> Table.State -> Table.SelectionRows row -> List String

The ids of all columns the selection intersects.

Cell selection geometry

intersectCellSelectionBounds

intersectCellSelectionBounds : Table.CellSelectionBounds -> Table.CellSelectionBounds -> Maybe Table.CellSelectionBounds

The overlap of two rectangles, or Nothing when they are disjoint.

subtractCellSelectionBounds

subtractCellSelectionBounds : Table.CellSelectionBounds -> Table.CellSelectionBounds -> List Table.CellSelectionBounds

The parts of the first rectangle the second does not cover, as up to four disjoint rectangles.

addCellSelectionBounds

addCellSelectionBounds : List Table.CellSelectionBounds -> Table.CellSelectionBounds -> List Table.CellSelectionBounds

Add a rectangle to a disjoint set, keeping the set disjoint.

mergeAdjacentCellSelectionBounds

mergeAdjacentCellSelectionBounds : List Table.CellSelectionBounds -> List Table.CellSelectionBounds

Fuse rectangles that share a full side into one, to a fixed point.

expandCellSelectionBounds

expandCellSelectionBounds : Table.CellSelectionBounds -> List Table.CellSelectionBounds -> Table.CellSelectionBounds

Grow a rectangle until it fully contains every merged-cell rectangle it touches.

applyCellSelectionBoundsOperations

applyCellSelectionBoundsOperations : List ( Table.CellSelectionOperation, Table.CellSelectionBounds ) -> List Table.CellSelectionBounds

Run ordered include and exclude operations, giving the final positive selection as disjoint rectangles.