@tanstack/solid-table
Version:
Headless UI for building powerful tables & datagrids for Solid.
45 lines • 1.63 kB
TypeScript
import { FlexRender } from "./FlexRender.js";
import { RowData, Table, TableFeatures, TableOptions } from "@tanstack/table-core";
import { JSX } from "solid-js";
//#region src/createTable.d.ts
type SolidTable<TFeatures extends TableFeatures, TData extends RowData> = Table<TFeatures, TData> & {
/**
* Creates a reactive render boundary. The child function reads the table
* atoms it needs, so Solid only tracks those atom reads.
*/
Subscribe: (props: {
children: (atoms: Table<TFeatures, TData>['atoms']) => JSX.Element;
}) => JSX.Element;
/**
* Convenience FlexRender component attached to the table instance for
* rendering headers, cells, or footers with custom markup. Mirrors the
* `table.FlexRender` API exposed by `createTableHook`'s `createAppTable`.
*
* @example
* <table.FlexRender header={header} />
* <table.FlexRender cell={cell} />
* <table.FlexRender footer={footer} />
*/
FlexRender: typeof FlexRender;
};
/**
* Creates a Solid table instance backed by Solid-aware TanStack Store atoms.
*
* Table APIs and atom reads participate in Solid dependency tracking, so
* computations that read a specific slice can update without invalidating
* unrelated UI. Use `table.Subscribe` to create atom-tracked render boundaries.
*
* @example
* ```tsx
* const table = createTable(
* {
* features,
* columns,
* data,
* },
* )
* ```
*/
declare function createTable<TFeatures extends TableFeatures, TData extends RowData>(tableOptions: TableOptions<TFeatures, TData>): SolidTable<TFeatures, TData>;
//#endregion
export { SolidTable, createTable };