@tanstack/svelte-table
Version:
Headless UI for building powerful tables & datagrids for Svelte.
18 lines (17 loc) • 598 B
TypeScript
import type { Updater } from '@tanstack/table-core';
/**
* Creates a small Svelte 5 state holder that accepts TanStack Table updaters.
*
* This is useful when a table state slice should be owned outside the table
* with `$state`, but still needs to accept both value and functional updater
* forms from `on[State]Change` callbacks.
*
* @example
* ```ts
* const [pagination, setPagination] = createTableState({
* pageIndex: 0,
* pageSize: 10,
* })
* ```
*/
export declare function createTableState<TState>(initialValue: TState): [() => TState, (updater: Updater<TState>) => void];