TanStack Table needs no special setup — it's a headless, framework-agnostic table library with a Svelte 5 runes adapter. You install it and import from @tanstack/svelte-table; in Mochi it bundles straight into whichever island imports it.
Declare which features you need with tableFeatures, pass your columns and
data, then render the header/cell definitions with <FlexRender />:
The whole table is plain server HTML: no mochi:hydrate, so nothing ships to the browser. This only makes sense when you don't need sorting, filtering, or any
client interaction — otherwise reach for an island.
Sortable table — mochi:hydrate
Registering rowSortingFeature makes the headers clickable — cycle ascending → descending → unsorted. Sorting runs on the client, so this card is a hydrated island.
```
### BasicTable.svelte
```svelte
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
{#each headerGroup.headers as header (header.id)}
{#if !header.isPlaceholder}
{/if}
{/each}
{/each}
{#each table.getRowModel().rows as row (row.id)}
{#each row.getAllCells() as cell (cell.id)}
{/each}
{/each}
```
### SortableTable.svelte
```svelte
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
{#each headerGroup.headers as header (header.id)}
{#if !header.isPlaceholder}
{/if}
{/each}
{/each}
{#each table.getRowModel().rows as row (row.id)}