TanStack Table
Reference Repositories
- TanStack Table - Headless table state and row models
- Svelte - Svelte 5 component and reactivity model
Upstream Grounding
When TanStack Table adapter APIs, row models, controlled state, sorting, filtering, pagination, or Svelte rendering helpers affect correctness, ask DeepWiki a narrow question against TanStack/table. Verify against the installed @tanstack/svelte-table and @tanstack/table-core versions.
This skill is for UI table state. Epicenter keeps rows as files in a folder (@epicenter/folder); use svelte for reading them into a component.
Local API Baseline
Epicenter currently uses @tanstack/svelte-table with:
import {
createTable as createSvelteTable,
FlexRender,
renderComponent,
} from '@tanstack/svelte-table';
import type { ColumnDef } from '@tanstack/table-core';
Table Construction Rules
- Always set
getRowId for persisted or local-first rows. Do not rely on array index identity.
- Keep
data referentially stable. Avoid creating a fresh array in the table options getter unless the table is intentionally rebuilt.
- Define columns with
satisfies ColumnDef<Row>[].
- Give accessor columns stable ids, especially when sorting, hiding, or persisted preferences are involved.
- Use
renderComponent for reusable header and cell components.
- Include only row models the UI uses: core always, sorted/filter/pagination only when the surface needs them.
Controlled State
- Control only state Epicenter owns externally, such as sorting, global filter, column visibility, row selection, or pagination.
- If an
onXChange handler is present, the matching state.get x() must also be present.
- Keep state ownership in one component or handle. Do not split sorting, filters, and pagination across unrelated stores without a reason.
Rendering
- TanStack Table owns row, column, and cell state.
@epicenter/ui/table owns semantic table markup and styling.
- Render headers and cells with
FlexRender.
- Key rows by
row.id and cells by cell.id.
- Empty states stay in
ui-design: when row count is zero, render Empty.Root in the table body or surrounding panel.
- Add explicit keyboard behavior for clickable rows. A click handler alone is not a row interaction model.
- Use TanStack Virtual separately for large lists. Do not treat virtualization as a built-in table feature.
1---2name: tanstack-table3description: Apply TanStack Table UI-state patterns for Svelte data tables, including columns, rendering, sorting, filtering, pagination, and row identity. Use when building or reviewing data-table UI, not Epicenter workspace storage tables.4metadata:5 source: https://skillmd.com/skills/epicenterhq/tanstack-table6 author: epicenter7 version: '1.0'8---910# TanStack Table1112## Reference Repositories1314- [TanStack Table](https://github.com/TanStack/table) - Headless table state and row models15- [Svelte](https://github.com/sveltejs/svelte) - Svelte 5 component and reactivity model1617## Upstream Grounding1819When TanStack Table adapter APIs, row models, controlled state, sorting, filtering, pagination, or Svelte rendering helpers affect correctness, ask DeepWiki a narrow question against `TanStack/table`. Verify against the installed `@tanstack/svelte-table` and `@tanstack/table-core` versions.2021This skill is for UI table state. Epicenter keeps rows as files in a folder (`@epicenter/folder`); use `svelte` for reading them into a component.2223## Local API Baseline2425Epicenter currently uses `@tanstack/svelte-table` with:2627```typescript28import {29 createTable as createSvelteTable,30 FlexRender,31 renderComponent,32} from '@tanstack/svelte-table';33import type { ColumnDef } from '@tanstack/table-core';34```3536## Table Construction Rules3738- Always set `getRowId` for persisted or local-first rows. Do not rely on array index identity.39- Keep `data` referentially stable. Avoid creating a fresh array in the table options getter unless the table is intentionally rebuilt.40- Define columns with `satisfies ColumnDef<Row>[]`.41- Give accessor columns stable ids, especially when sorting, hiding, or persisted preferences are involved.42- Use `renderComponent` for reusable header and cell components.43- Include only row models the UI uses: core always, sorted/filter/pagination only when the surface needs them.4445## Controlled State4647- Control only state Epicenter owns externally, such as sorting, global filter, column visibility, row selection, or pagination.48- If an `onXChange` handler is present, the matching `state.get x()` must also be present.49- Keep state ownership in one component or handle. Do not split sorting, filters, and pagination across unrelated stores without a reason.5051## Rendering5253- TanStack Table owns row, column, and cell state. `@epicenter/ui/table` owns semantic table markup and styling.54- Render headers and cells with `FlexRender`.55- Key rows by `row.id` and cells by `cell.id`.56- Empty states stay in `ui-design`: when row count is zero, render `Empty.Root` in the table body or surrounding panel.57- Add explicit keyboard behavior for clickable rows. A click handler alone is not a row interaction model.58- Use TanStack Virtual separately for large lists. Do not treat virtualization as a built-in table feature.