DataInteractive playground
DataTable
Data with search, sorting, selection and pagination.
Preparing the playground…
Text and Markdown example
DataTable · Example
1<DataTable columns={[{accessorKey:"name",header:"Name"},{accessorKey:"role",header:"Role"}]} data={[{name:"Sofía Martín",role:"Design"},{name:"Lucas García",role:"Development"},{name:"Emma Wilson",role:"Product"}]} searchable paginated pageSize={2} />How to use it
Define columns using accessorKey and header and pass data as an array. Columns use LegacyColumnDef from the TanStack version included in Kivora.
Import
React / Next.js
1import { DataTable } from "@kivora/nextjs";Interactive examples run inside a component with "use client". The playground's Copy button includes the imports needed for the current example.
API reference 0.2.0
Types from the installed published version, including component properties and common HTML attributes. “Optional” does not imply a default value; omitting a property lets the component decide.
| Property | Type | Description |
|---|---|---|
columnsRequired | LegacyColumnDef<TData, unknown>[] | Column definitions, data access and presentation. |
dataRequired | TData[] | Rows to display. |
advanced | boolean | Configures advanced. The type describes the supported values and structure. |
aria-label | string | Accessible name of the control. |
bulkActions | DataTableBulkAction<TData>[] | Configures bulkActions. The type describes the supported values and structure. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
emptyMessage | ReactNode | Content when there are no results. |
filterable | boolean | Enable filters. |
filterMenuOpen | boolean | Configures filterMenuOpen. The type describes the supported values and structure. |
filters | DataTableFilter[] | Definition of available filters. |
id | string | Element identifier; associates labels and descriptions. |
multiSelect | boolean | Allow multiple row selection. |
onChange | ChangeEventHandler<HTMLTableElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLTableElement> | Action performed when the element is activated. |
onFilterMenuOpenChange | ((open: boolean) => void) | Callback for this event. The signature describes its arguments. |
onSubmit | SubmitEventHandler<HTMLTableElement> | Form submission event. |
pageSize | number | Number of rows per page. |
pageSizeOptions | number[] | Available page sizes. |
paginated | boolean | Enable pagination. |
paginationVariant | "buttons" | "numbers" | Configures paginationVariant. The type describes the supported values and structure. |
renderRowActions | ((row: TData) => ReactNode) | Configures renderRowActions. The type describes the supported values and structure. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
rowActions | DataTableAction<TData>[] | Configures rowActions. The type describes the supported values and structure. |
searchable | boolean | Enable built-in search. |
searchPlaceholder | string | Search hint text. |
selectable | boolean | Allow row selection. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
TypeScript definition
Review each component's properties and published declaration. Native and accessibility attributes are inherited from the element specified by its type.
DataTable32 properties
DataTable · TypeScript
1declare function DataTable<TData extends RowData>({ advanced, columns, data, emptyMessage, filterable, filters, filterMenuOpen, className, multiSelect, onFilterMenuOpenChange, pageSize, pageSizeOptions, paginated, paginationVariant, renderRowActions, rowActions, bulkActions, searchable, searchPlaceholder, selectable, ...props }: DataTableProps<TData>): React.JSX.Element;API generated from @kivora/nextjs 0.2.0View package