Skip to main content

DataTable

Production-ready data table with automatic data fetching and state management

Example

"use client";

import { DataTable } from "@databricks/appkit-ui/react";

export default function DataTableExample() {
return (
<DataTable
queryKey="example_query"
parameters={{}}
filterColumn="name"
filterPlaceholder="Filter by name..."
pageSize={10}
/>
);
}

DataTable

Production-ready data table with automatic data fetching and state management

Features:

  • Automatic column generation from data structure
  • Integrated with useAnalyticsQuery for data fetching
  • Built-in loading, error, and empty states
  • Dynamic filtering, sorting and pagination
  • Column visibility controls
  • Responsive design
  • Supports opinionated mode (auto columns) and full-control mode (children(table))

Source: packages/appkit-ui/src/react/table/data-table.tsx

Props

PropTypeRequiredDefaultDescription
queryKeystring-The query key to fetch the data
parametersRecord<string, any>-The parameters to pass to the query
filterColumnstring-The column to filter by
filterPlaceholderstring-Optional placeholder for the filter input
transform((data: any[]) => any[])-Optional function to transform data before creating table
labelsDataTableLabels-Optional labels for the DataTable component
ariaLabelstring-Optional accessibility label for the DataTable component
testIdstring-Optional test ID for the DataTable component
classNamestring-Optional CSS class name for the DataTable component
enableRowSelectionboolean-Enable row selection with checkboxes
onRowSelectionChange((rowSelection: RowSelectionState) => void)-Callback function to handle row selection changes
children((table: Table<any>) => ReactNode)-Optional children for full control mode
pageSizenumber-Number of rows to display per page
pageSizeOptionsnumber[]-Options for the page size selector

Usage

import { DataTable } from '@databricks/appkit-ui';

<DataTable /* props */ />