States

Loading, empty, error, and custom skeleton states for DataTable.

Overview

DataTable has built-in rendering paths for loading, empty, and error states so the surrounding layout does not need to branch around the table container.

Loading

Set loading to render skeleton rows. By default the table uses a generic skeleton for each cell.

<DataTable
  columns={columns}
  data={[]}
  loading
  skeletonRowCount={8}
/>

Empty and Error

Pass an emptyState object when the zero-rows case needs product copy or a URL-trigger action. Pass error when loading failed and you want the table to render an error row instead.

<DataTable
  columns={columns}
  data={[]}
  emptyState={{
    title: "No employees found",
    description: "Get started by adding your first employee",
    action: {
      label: "Add employee",
      paramName: "dialog",
      paramSetValue: "add-employee",
    },
  }}
  error={loadError ? "Failed to load employees" : null}
/>

Custom Skeletons

Use ColumnDef.meta.skeleton when a column needs a more realistic placeholder shape.

Component Overrides

For fully custom loading or error rendering, override the table-level state components:

<DataTable
  columns={columns}
  data={data}
  components={{
    LoadingState: ({ colSpan }) => <tr><td colSpan={colSpan}>Loading...</td></tr>,
    ErrorState: ({ colSpan, error }) => <tr><td colSpan={colSpan}>{error}</td></tr>,
  }}
/>

API Reference

Prop / FieldTypeDescription
loadingbooleanShow the loading state with skeleton rows
errorstring | null | undefinedShow the error state with the provided message
skeletonRowCountnumber | "auto"Number of skeleton rows, or auto-calculate from container height
emptyStateobjectEmpty-state copy, icon, and optional action
components.LoadingStateComponentType<{ colSpan: number }>Replace the default loading row
components.ErrorStateComponentType<{ colSpan: number; error: string }>Replace the default error row
ColumnDef.meta.skeleton() => ReactNodeCustomize the loading skeleton for one column

On this page