Table
Data table with antd-shaped columns, local or server sorting, header filters, pagination, sticky header and fixed columns. Built on TanStack Table v9.
import { Table } from '@lobehub/ui/base-ui';Data Display
Basic
Sort by clicking a header, filter from the funnel icon, page through with the pager. scroll.y keeps the header in view; fixed: 'right' pins the action column.
Loading preview
Server-driven
sorter: true leaves row order alone and reports the sort through onChange; pagination.total switches the pager to server mode. Fetch the page yourself and pass it as dataSource.
Loading preview
APIs
Table properties
borderedbooleanclassNamestringclassNamesPartial<Record<TableSemanticName, string>>columnsRequiredTableColumn<T>[]dataSourceT[]emptyTextnull | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>loadingbooleanonChange(pagination: TablePaginationConfig, filters: TableFilters, sorter: TableSorterResult<T>) => voidonRow(record: T, index: number) => HTMLAttributes<HTMLTableRowElement>paginationfalse | TablePaginationConfigrefnull | (instance: HTMLDivElement | null) => void | (() => VoidOrUndefinedOnly) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES] | RefObject<HTMLDivElement | null>rowClassNamestring | (record: T, index: number) => stringrowKeyRequiredExtract<keyof T, string> | ((record: T) => Key)scroll{ x?: number | string; y?: number | string; }size'small' | 'middle'styleCSSPropertiesstylesPartial<Record<TableSemanticName, CSSProperties>>tableLayout'auto' | 'fixed'
Migrating from antd Table
columns,dataSource,rowKey,pagination,onChange,onRow,rowClassName,scroll,size(small/middle),bordered,loadingandtableLayoutkeep their antd shape.locale={{ emptyText }}→emptyText.- Delete
.ant-table-*style overrides; useclassNames/styles(wrapper,header,body,row,cell). - Row selection, expandable rows, virtual scrolling, summary rows, tree data, column resizing, multi-column sort, controlled
sortOrder, customfilterDropdownand arraydataIndexpaths are not supported.
Helpful?