function createTableHook<TFeatures, TTableComponents, TCellComponents, THeaderComponents>(__namedParameters): object;function createTableHook<TFeatures, TTableComponents, TCellComponents, THeaderComponents>(__namedParameters): object;Defined in: packages/svelte-table/src/createTableHook.svelte.ts:419
Creates a custom table hook with pre-bound components for composition.
This is the table equivalent of TanStack Form's createFormHook. It allows you to:
TFeatures extends TableFeatures
TTableComponents extends Record<string, ComponentType<any>>
TCellComponents extends Record<string, ComponentType<any>>
THeaderComponents extends Record<string, ComponentType<any>>
CreateTableHookOptions<TFeatures, TTableComponents, TCellComponents, THeaderComponents>
appFeatures: TFeatures;appFeatures: TFeatures;createAppColumnHelper: <TData>() => AppColumnHelper<TFeatures, TData, TCellComponents, THeaderComponents>;createAppColumnHelper: <TData>() => AppColumnHelper<TFeatures, TData, TCellComponents, THeaderComponents>;Create a column helper pre-bound to the features and components configured in this table hook. The cell, header, and footer contexts include pre-bound components (e.g., cell.TextCell).
TData extends RowData
AppColumnHelper<TFeatures, TData, TCellComponents, THeaderComponents>
createAppTable: <TData, TSelected>(tableOptions, selector?) => AppSvelteTable<TFeatures, TData, TSelected, TTableComponents, TCellComponents, THeaderComponents>;createAppTable: <TData, TSelected>(tableOptions, selector?) => AppSvelteTable<TFeatures, TData, TSelected, TTableComponents, TCellComponents, THeaderComponents>;Enhanced createTable hook that returns a table with App wrapper components and pre-bound tableComponents attached directly to the table object.
Default options from createTableHook are automatically merged with the options passed here. Options passed here take precedence.
TFeatures is already known from the createTableHook call; TData is inferred from the data prop.
TData extends RowData
TSelected = TableState<TFeatures>
Omit<TableOptions<TFeatures, TData>, "_features" | "_rowModels">
(state) => TSelected
AppSvelteTable<TFeatures, TData, TSelected, TTableComponents, TCellComponents, THeaderComponents>
useCellContext: <TValue>() => Cell<TFeatures, any, TValue>;useCellContext: <TValue>() => Cell<TFeatures, any, TValue>;Access the cell instance from within an AppCell wrapper. Use this in custom cellComponents passed to createTableHook. TFeatures is already known from the createTableHook call.
TValue extends unknown = unknown
Cell<TFeatures, any, TValue>
useHeaderContext: <TValue>() => Header<TFeatures, any, TValue>;useHeaderContext: <TValue>() => Header<TFeatures, any, TValue>;Access the header instance from within an AppHeader or AppFooter wrapper. Use this in custom headerComponents passed to createTableHook. TFeatures is already known from the createTableHook call.
TValue extends unknown = unknown
Header<TFeatures, any, TValue>
useTableContext: <TData>() => SvelteTable<TFeatures, TData>;useTableContext: <TData>() => SvelteTable<TFeatures, TData>;Access the table instance from within an AppTable wrapper. Use this in custom tableComponents passed to createTableHook. TFeatures is already known from the createTableHook call.
TData extends RowData = RowData
SvelteTable<TFeatures, TData>
// hooks/table.ts
export const {
createAppTable,
createAppColumnHelper,
useTableContext,
useCellContext,
useHeaderContext,
} = createTableHook({
_features: tableFeatures({
rowPaginationFeature,
rowSortingFeature,
columnFilteringFeature,
}),
_rowModels: {
paginatedRowModel: createPaginatedRowModel(),
sortedRowModel: createSortedRowModel(sortFns),
filteredRowModel: createFilteredRowModel(filterFns),
},
tableComponents: { PaginationControls, RowCount },
cellComponents: { TextCell, NumberCell },
headerComponents: { SortIndicator, ColumnFilter },
})// hooks/table.ts
export const {
createAppTable,
createAppColumnHelper,
useTableContext,
useCellContext,
useHeaderContext,
} = createTableHook({
_features: tableFeatures({
rowPaginationFeature,
rowSortingFeature,
columnFilteringFeature,
}),
_rowModels: {
paginatedRowModel: createPaginatedRowModel(),
sortedRowModel: createSortedRowModel(sortFns),
filteredRowModel: createFilteredRowModel(filterFns),
},
tableComponents: { PaginationControls, RowCount },
cellComponents: { TextCell, NumberCell },
headerComponents: { SortIndicator, ColumnFilter },
})