Table API
TanStack's Table API Reference documents the table instance: the object constructTable returns, the options it is given, the state it holds, and the feature registry that decides which of its methods exist. elm-table has no table instance. A table is a Config (what the columns are and which flags are set), a State (what the user has done), and the row-model functions that turn the two into rows. This page maps TanStack's entries onto ours. Full signatures and doc comments live on the generated Table module page.
Types and construction
| TanStack | elm-table | Notes |
|---|---|---|
Table |
— | No table instance. Pass a Config and a State to the function you want; see Config and State. |
TableOptions |
Config |
A plain record, built once with config and adjusted with the builders below or by record update. |
TableState |
State |
A plain record you keep in your own model. See Table State. |
TableMeta |
— | No meta bag. Anything a renderer needs that is not a column value stays in your own model. |
TableFeature |
— | No feature registry. Every feature is compiled into the package and is inert until its state slice is non-empty. |
TableFeatures |
— | Same reason. There is no type parameter for "which features are on". |
StockFeatures |
— | Same reason. |
CoreFeatures |
— | Same reason. |
constructTable |
— | Nothing to construct. config makes the config; rows makes the row model. |
tableOptions |
config |
TanStack's helper only fixes inference on an options object. Ours actually builds the record, with TanStack's defaults for every flag. |
tableFeatures |
— | No feature registry to declare. |
getInitialTableState |
initialState |
A value, not a function: nothing sorted, nothing filtered, nothing grouped, page 0 of size 10. |
DebugOptions |
— | No debug flags. The pipeline is a chain of pure functions you can call one stage at a time; see Row Models. |
State ownership
TanStack v9 stores each state slice in an atom and hands you onChange callbacks. In Elm the state is already yours: a transition takes a State and returns a new one, and you store it in your model.
| TanStack | elm-table | Notes |
|---|---|---|
BaseAtoms |
— | No atoms. State is a record in your model. |
Atoms |
— | No derived atoms. Every read is a function of Config and State. |
ExternalAtoms |
— | Nothing to take ownership of, because state is external by default. |
OnChangeFn |
— | Transitions return a State. You decide what to do with it. |
Updater |
— | No "value or function" argument. A transition is already State -> State. |
React-only entries
These are entries in TanStack's React adapter. Elm has no hooks and no component render props, so none of them has a counterpart. Rendering is entirely your code.
| TanStack | elm-table | Notes |
|---|---|---|
useTable |
— | No hooks. Hold Config and State in your model. |
createTableHook |
— | No hooks to compose. |
ReactTable |
— | No framework-specific table type. |
AppReactTable |
— | Same reason. |
CreateTableHookOptions |
— | Same reason. |
Subscribe |
— | No subscriptions to state slices. An Elm update already runs on every message. |
FlexRender |
— | Column definitions hold data, not renderers. See Column Definitions. |
flexRender |
— | Write the Html yourself from the column id, the header string, and the cell value. |
Config builders
Everything on this page's TanStack side that does exist here is reached through these. config starts from TanStack's defaults; each builder changes one field. Config is a plain record, so any field the builders do not cover (manualSorting, enableGrouping, filterFromLeafRows, pageCount, and the rest) is set by record update.
| Value | What it does |
|---|---|
config |
Builds a Config from a list of columns, with TanStack's defaults for every flag. |
initialState |
The starting State. |
withGetRowId |
Give rows stable ids from the datum, its index among its siblings, and its parent's row id. Without it, root rows are "0", "1", and children "0.1", "0.2". |
withSubRows |
Tell the core row model how to reach a row's children. |
withDefaultColumn |
Override the default column sizing (150, 20, 9007199254740991). |
withGlobalFilterFn |
Set the filter function the global filter uses. |
withRowSelection |
Decide per row whether it can be selected. |
withRowCanExpand |
Per-row override for "can this row expand?". It wins over enableExpanding and over the "has sub-rows" rule. |
withIsRowExpanded |
Per-row override for "is this row expanded?". It wins over State.expanded. |
withCellSpanning |
Allow or forbid cell spanning for the whole table. |
withCellSelection |
Allow or forbid cell selection for the whole table. |
withCellSelectionWhen |
Decide per cell whether it can be selected, replacing the boolean above. |
withCellRangeSelection |
Allow or forbid extending a cell selection into a range, which is what shift-click and drag do. |
withMultiCellRangeSelection |
Allow or forbid adding and subtracting further rectangles, which is what ctrl-click and meta-click do. |
Two builders that read as table-level in TanStack are column builders here: withMaxAggregationDepth and withEnableCellSelection take a Column. They are on the Column API page.