Skip to main content
Brand and assets
Build
Monitor and contribute
/
Patterns & layouts
  • Overview
  • Layouts
  • PageLayout
  • FullPageLayout
  • Patterns
  • Forms & density
  • Composition (asChild)
  • Rich components
  • DataTable
    • useDataTable
    • DataTable
    • Examples
  • DataTable
  • DataTable

DataTable

The default renderer for useDataTable — draws the standard Murray toolbar, filter bar and table.

Health
Component health
Source
View on Github
Storybook
View in Storybook
Playground
No Example
Accessibility
unknown
Platform
Web
  • Overview
  • Props

DataTable is the default renderer for a table built with useDataTable. It consumes the hook's instance and draws the standard Murray layout: an optional toolbar/filter row above a table. It holds no state of its own — all behavior (filters, selection, row navigation) rides on the instance and lives in the hook.

5 employees

Employees
NameEntityCommentStatus
FooBarBlabla

Covered

QuxBarOnboarding

Not covered

ZapBazNew hire

Covered

WobBazLeft

Not covered

NixBarPaperwork

Processing

Props​

PropTypeDefaultDescription
tableDataTableInstance<T>—Required. The instance returned by useDataTable.
toolbar{ placement: "start" | "end"; component: ReactNode }[][]Extra elements above the table, grouped start/end (counts, buttons…).
titlestring | nullnullAccessible table title. Pass a string when the page doesn't already describe the table.
loadingbooleanfalseNo rows: skeleton body. Rows on screen: loading overlay over them. See Loading.

A filter bar renders at the start of the toolbar whenever the instance carries filter defs (filters.defs on the hook) — there is no separate prop for it. Likewise, a centered pager footer renders under the table whenever the instance carries pagination (hidden while there is a single known page).

Toolbar​

toolbar elements are grouped by placement and laid out on either side of the row above the table — start elements sit next to the filter bar, end elements are pushed to the far end. Use it for row counts, bulk actions, exports, etc.

5 employees

Employees
NameEntityCommentStatus
FooBarBlabla

Covered

QuxBarOnboarding

Not covered

ZapBazNew hire

Covered

WobBazLeft

Not covered

NixBarPaperwork

Processing

Loading​

loading picks the right visual from what's on screen — you never declare the phase yourself:

  • No rows to show (first load): the body renders skeleton rows — pagination.pageSize of them (5 without pagination).
  • Rows on screen (a refetch keeping the previous rows via placeholderData: keepPreviousData): the rows stay put under a loading overlay that blocks interactions until the fetch resolves
Employees
NameEntityCommentStatus
Loading…‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
Employees
NameEntityCommentStatus
FooBarBlabla

Covered

QuxBarOnboarding

Not covered

ZapBazNew hire

Covered

WobBazLeft

Not covered

NixBarPaperwork

Processing

Building your own renderer​

DataTable is only one way to render the hook's output. If the standard layout doesn't fit, skip it and read directly from the instance: instance.table is the cherry-picked @tanstack/react-table surface, and instance.filters, instance.selection and instance.rowNavigation sit next to it — the state and logic still come from useDataTable.

Accessibility​

  • title — accessible table title (pass one unless the surrounding page already labels the table).
  • Row-level labels (selection.getRowLabel, rowNavigation.getRowNavigationLabel) are configured on the hook — see useDataTable.
  • While loading, skeletons are aria-hidden; a visually-hidden localized "Loading…" announces the state.

Undocumented props

NameTypeDefault ValueDescriptionUsage count
loadingany
tableany
titleany
toolbarany
Edit this page
Previous
useDataTable
Next
Examples
  • Props
  • Toolbar
  • Loading
  • Building your own renderer
  • Accessibility