Theme Switcher

Data Table

Preview

Tables purposefully designed for dynamic, application data with features like sorting, filtering, and pagination. Powered by TanStack Table.

m5gr84i9316successken99@example.com
3u1reuv4242successAbe45@example.com
derv1ws0837processingMonserrat44@example.com
5kma53ae874successSilas22@example.com
bhqecj4p721failedcarmella@example.com

No results.

import {
	DataTable,
	DataTableBody,
	DataTableHead,
	DataTableHeader,
	DataTableHeaderSortButton,
	DataTableRows,
	EmptyDataTableRow,
	createColumnHelper,
	getCoreRowModel,
	getFilteredRowModel,
	getPaginationRowModel,
	getSortedRowModel,
	useReactTable,
} from "@ngrok/mantle/data-table";

function PaymentsExample() {
	const data = useMemo(() => examplePayments, []);

	const table = useReactTable({
		data,
		columns,
		getCoreRowModel: getCoreRowModel(),
		getPaginationRowModel: getPaginationRowModel(),
		getSortedRowModel: getSortedRowModel(),
		getFilteredRowModel: getFilteredRowModel(),
		initialState: {
			pagination: {
				pageSize: 100,
			},
		},
	});

	return (
		<DataTable table={table}>
			<DataTableHead />
			<DataTableBody>
				{table.getRowModel().rows.length > 0 ? (
					<DataTableRows />
				) : (
					<EmptyDataTableRow>
						<p className="flex items-center justify-center min-h-20">
							No results.
						</p>
					</EmptyDataTableRow>
				)}
			</DataTableBody>
		</DataTable>
	);
}

API Reference

The DataTable accepts the following props in addition to...