# Data Table (/docs/components/data-table)

> This page documents oakoss/ui, built on React Aria Components, not shadcn/ui or Radix. Treat it as authoritative over what you know of those libraries.

<Tabs defaultValue="Preview">
  <TabsList>
    <TabsTrigger value="Preview">
      Preview
    </TabsTrigger>

    <TabsTrigger value="Code">
      Code
    </TabsTrigger>
  </TabsList>

  <TabsContent value="Preview">
    <DataTableDemo />
  </TabsContent>

  <TabsContent value="Code">
    ```tsx
    import {
      DataTable,
      DataTableContent,
      DataTableToolbar,
    } from '#/components/ui/data/data-table';
    import { DataTableActionBar } from '#/components/ui/data/data-table-action-bar';
    import {
      actionsColumn,
      currencyColumn,
      dateColumn,
      selectionColumn,
    } from '#/components/ui/data/data-table-columns';
    import { DataTablePagination } from '#/components/ui/data/data-table-pagination';
    import { DataTableViewOptions } from '#/components/ui/data/data-table-view-options';
    import { Button } from '#/components/ui/inputs/button';
    import {
      type DataTableColumn,
      useDataTable,
    } from '#/hooks/use-data-table';

    type Payment = {
      amount: number;
      createdAt: string;
      email: string;
      id: string;
      status: string;
    };

    const payments: Payment[] = [
      ['PAY-001', 'paid', 'ada@example.com', 250, '2026-01-04'],
      ['PAY-002', 'pending', 'grace@example.com', 150, '2026-01-09'],
      ['PAY-003', 'failed', 'alan@example.com', 350, '2026-02-02'],
      ['PAY-004', 'paid', 'katherine@example.com', 450, '2026-02-17'],
      ['PAY-005', 'paid', 'linus@example.com', 550, '2026-03-01'],
      ['PAY-006', 'pending', 'margaret@example.com', 200, '2026-03-12'],
      ['PAY-007', 'paid', 'barbara@example.com', 300, '2026-04-05'],
      ['PAY-008', 'failed', 'dennis@example.com', 120, '2026-04-21'],
    ].map(([id, status, email, amount, createdAt]) => ({
      amount: Number(amount),
      createdAt: String(createdAt),
      email: String(email),
      id: String(id),
      status: String(status),
    }));

    const columns: DataTableColumn<Payment>[] = [
      selectionColumn<Payment>({ rowLabel: (row) => `Select ${row.original.id}` }),
      {
        accessorKey: 'id',
        enableHiding: false,
        header: 'Payment',
        meta: { isRowHeader: true },
      },
      { accessorKey: 'status', header: 'Status' },
      { accessorKey: 'email', header: 'Email' },
      dateColumn<Payment>('createdAt', { header: 'Created' }),
      currencyColumn<Payment>('amount', { currency: 'USD', header: 'Amount' }),
      actionsColumn<Payment>({
        cell: (row) => (
          <Button intent="neutral" size="sm" variant="ghost">
            Refund<span className="sr-only"> {row.original.id}</span>
          </Button>
        ),
      }),
    ];

    export function DataTableDemo() {
      const table = useDataTable({
        columns,
        data: payments,
        defaultState: { pagination: { pageIndex: 0, pageSize: 5 } },
        enableRowSelection: true,
        getRowId: (row) => row.id,
      });
      return (
        <DataTable className="not-prose w-full" table={table}>
          <DataTableToolbar>
            <DataTableViewOptions />
          </DataTableToolbar>
          <DataTableContent aria-label="Payments" />
          <DataTableActionBar />
          <DataTablePagination pageSizes={[5, 10]} />
        </DataTable>
      );
    }

    ```
  </TabsContent>
</Tabs>


## Installation [#installation]

<Tabs defaultValue="CLI">
  <TabsList>
    <TabsTrigger value="CLI">
      CLI
    </TabsTrigger>

    <TabsTrigger value="Manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="CLI">
    <CodeBlockTabs defaultValue="npm" groupId="package-manager" persist>
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="npm">
          npm
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="pnpm">
          pnpm
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="yarn">
          yarn
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="bun">
          bun
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="npm">
        ```bash
        npx shadcn@latest add @oakoss/data-table
        ```
      </CodeBlockTab>

      <CodeBlockTab value="pnpm">
        ```bash
        pnpm dlx shadcn@latest add @oakoss/data-table
        ```
      </CodeBlockTab>

      <CodeBlockTab value="yarn">
        ```bash
        yarn dlx shadcn@latest add @oakoss/data-table
        ```
      </CodeBlockTab>

      <CodeBlockTab value="bun">
        ```bash
        bunx --bun shadcn@latest add @oakoss/data-table
        ```
      </CodeBlockTab>
    </CodeBlockTabs>
  </TabsContent>

  <TabsContent value="Manual">
    <Steps>
      <Step>
        Set up the theme and base styles from [Installation](/docs/installation).
      </Step>

      <Step>
        Install the packages.

        <CodeBlockTabs defaultValue="npm" groupId="package-manager" persist>
          <CodeBlockTabsList>
            <CodeBlockTabsTrigger value="npm">
              npm
            </CodeBlockTabsTrigger>

            <CodeBlockTabsTrigger value="pnpm">
              pnpm
            </CodeBlockTabsTrigger>

            <CodeBlockTabsTrigger value="yarn">
              yarn
            </CodeBlockTabsTrigger>

            <CodeBlockTabsTrigger value="bun">
              bun
            </CodeBlockTabsTrigger>
          </CodeBlockTabsList>

          <CodeBlockTab value="npm">
            ```bash
            npm install @tanstack/react-table@^9 cn react-aria-components tailwind-variants
            ```
          </CodeBlockTab>

          <CodeBlockTab value="pnpm">
            ```bash
            pnpm add @tanstack/react-table@^9 cn react-aria-components tailwind-variants
            ```
          </CodeBlockTab>

          <CodeBlockTab value="yarn">
            ```bash
            yarn add @tanstack/react-table@^9 cn react-aria-components tailwind-variants
            ```
          </CodeBlockTab>

          <CodeBlockTab value="bun">
            ```bash
            bun add @tanstack/react-table@^9 cn react-aria-components tailwind-variants
            ```
          </CodeBlockTab>
        </CodeBlockTabs>
      </Step>

      <Step>
        Copy each file into your project, and change its `#/` imports to your aliases.

        * [`components/ui/feedback/spinner.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/feedback/spinner.tsx)

        * [`components/icons.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/icons.tsx)

        * [`components/icon-placeholder.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/icon-placeholder.tsx)

        * [`lib/cx.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/cx.ts)

        * [`lib/cn-config.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/cn-config.ts)

        * [`components/ui/inputs/button.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/button.tsx)

        * [`lib/recipes.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/recipes.ts)

        * [`components/ui/layout/separator.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/layout/separator.tsx)

        * [`components/ui/inputs/input.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/input.tsx)

        * [`components/ui/inputs/field.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/field.tsx)

        * [`lib/empty-node.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/empty-node.ts)

        * [`components/ui/inputs/checkbox.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/checkbox.tsx)

        * [`components/ui/overlays/dialog.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/dialog.tsx)

        * [`hooks/use-scroll-region.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-scroll-region.ts)

        * [`components/ui/overlays/popover.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/popover.tsx)

        * [`components/ui/overlays/dropdown-menu.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/dropdown-menu.tsx)

        * [`components/ui/overlays/menu.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/menu.tsx)

        * [`components/ui/overlays/menu-item.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/menu-item.tsx)

        * [`lib/empty-state.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/empty-state.ts)

        * [`lib/text-value.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/text-value.ts)

        * [`components/ui/inputs/input-group.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/input-group.tsx)

        * [`components/ui/inputs/select.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/select.tsx)

        * [`components/ui/inputs/list-box.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/list-box.tsx)

        * [`components/ui/feedback/skeleton.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/feedback/skeleton.tsx)

        * [`components/ui/data/table.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/table.tsx)

        * [`components/ui/data/data-table.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table.tsx)

        * [`components/ui/data/data-table-action-bar.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-action-bar.tsx)

        * [`components/ui/data/data-table-announcer.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-announcer.tsx)

        * [`components/ui/data/data-table-body.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-body.tsx)

        * [`components/ui/data/data-table-columns.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-columns.tsx)

        * [`components/ui/data/data-table-header.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-header.tsx)

        * [`components/ui/data/data-table-pagination.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-pagination.tsx)

        * [`components/ui/data/data-table-view-options.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-view-options.tsx)

        * [`hooks/use-data-table.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-data-table.ts)

        * [`hooks/use-data-table-filters.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-data-table-filters.ts)

        * [`hooks/use-data-table-selection.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-data-table-selection.ts)

        * [`hooks/use-data-table-state.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-data-table-state.ts)

        * [`hooks/use-latest.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-latest.ts)

        * [`lib/data-table-headers.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-headers.ts)

        * [`lib/data-table-query.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-query.ts)

        * [`lib/data-table-selection.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-selection.ts)

        * [`lib/data-table-state.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-state.ts)

        * [`lib/data-table-status.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-status.ts)
      </Step>

      <Step>
        Add this CSS to your stylesheet.

        ```css
        @custom-variant linked (&[aria-current]:not([aria-current=false]));
        ```
      </Step>

      <Step>
        Replace each `<IconPlaceholder>` in `icons.tsx` with your icon library's icon, named in its props. The CLI does this for you; without it, icons render as empty squares.
      </Step>
    </Steps>
  </TabsContent>
</Tabs>


## Usage [#usage]

```tsx
import {
  DataTable,
  DataTableContent,
  DataTableToolbar,
} from '#/components/ui/data/data-table';
import { DataTableActionBar } from '#/components/ui/data/data-table-action-bar';
import {
  currencyColumn,
  selectionColumn,
} from '#/components/ui/data/data-table-columns';
import { DataTablePagination } from '#/components/ui/data/data-table-pagination';
import { DataTableViewOptions } from '#/components/ui/data/data-table-view-options';
import { type DataTableColumn, useDataTable } from '#/hooks/use-data-table';

const columns: DataTableColumn<Payment>[] = [
  selectionColumn<Payment>(),
  { accessorKey: 'id', header: 'Payment', meta: { isRowHeader: true } },
  currencyColumn<Payment>('amount', { currency: 'USD', header: 'Amount' }),
];

function Payments({ payments }: { payments: Payment[] }) {
  const table = useDataTable({
    columns,
    data: payments,
    enableRowSelection: true,
    getRowId: (payment) => payment.id,
  });
  return (
    <DataTable table={table}>
      <DataTableToolbar>
        <DataTableViewOptions />
      </DataTableToolbar>
      <DataTableContent aria-label="Payments" />
      <DataTableActionBar />
      <DataTablePagination />
    </DataTable>
  );
}
```

`useDataTable` creates a [TanStack Table](https://tanstack.com/table) with
sorting, filtering, pagination, selection and column visibility registered,
and `DataTable` hands it to every part inside, so the parts compose in any
layout. Keep `columns` outside the component, or memoize them: a new array
each render rebuilds the rows.

Each state slice (`sorting`, `pagination`, `selection`, `columnVisibility`,
`columnFilters` and `globalFilter`) is the hook's own until you pass it in
`state`, and its change handler (`onSortingChange` and so on) hears every
change either way. That's how a slice moves into the URL or a store. Set
starting values with `defaultState`.

Column `meta` tells the parts what a header can't: `label` names the column
in the column menu and announcements when its header isn't text, `align`
and `className` style its cells, and `isRowHeader` makes its cells head their
rows. To add your own keys, edit `DataTableColumnMeta` in the installed hook.

## Examples [#examples]

### Server data [#server-data]

With `mode: 'server'`, the table shows `data` as given and pages through
`rowCount` rows, and the type asks for that count. Sorting or filtering
returns to the first page. `dataTableQuery` turns the state into a 1-based
`page`, `pageSize`, a `sort` like `-total` and the filters, for a URL or a
fetch; put the same values in your data library's cache key. The table
doesn't fetch, so any data library fits.

<Tabs defaultValue="Preview">
  <TabsList>
    <TabsTrigger value="Preview">
      Preview
    </TabsTrigger>

    <TabsTrigger value="Code">
      Code
    </TabsTrigger>
  </TabsList>

  <TabsContent value="Preview">
    <DataTableServer />
  </TabsContent>

  <TabsContent value="Code">
    ```tsx
    import {
      DataTable,
      DataTableContent,
    } from '#/components/ui/data/data-table';
    import { currencyColumn } from '#/components/ui/data/data-table-columns';
    import { DataTablePagination } from '#/components/ui/data/data-table-pagination';
    import {
      type DataTableColumn,
      type DataTableState,
      useDataTable,
    } from '#/hooks/use-data-table';
    import { dataTableQuery } from '#/lib/data-table-query';
    import { useState } from 'react';

    type Order = { id: string; total: number };

    const columns: DataTableColumn<Order>[] = [
      { accessorKey: 'id', header: 'Order', meta: { isRowHeader: true } },
      currencyColumn<Order>('total', { currency: 'USD', header: 'Total' }),
    ];

    const sorts = new Map<string, (a: Order, b: Order) => number>([
      ['-id', (a, b) => b.id.localeCompare(a.id)],
      ['-total', (a, b) => b.total - a.total],
      ['id', (a, b) => a.id.localeCompare(b.id)],
      ['total', (a, b) => a.total - b.total],
    ]);

    export function DataTableServer() {
      const [state, setState] = useState<
        Pick<DataTableState, 'pagination' | 'sorting'>
      >({ pagination: { pageIndex: 0, pageSize: 5 }, sorting: [] });
      const query = dataTableQuery({
        ...state,
        columnFilters: [],
        globalFilter: '',
      });
      const { rowCount, rows } = fetchOrders(query);
      const table = useDataTable({
        columns,
        data: rows,
        mode: 'server',
        onPaginationChange: (pagination) =>
          setState((previous) => ({ ...previous, pagination })),
        onSortingChange: (sorting) =>
          setState((previous) => ({ ...previous, sorting })),
        rowCount,
        state,
      });
      return (
        <DataTable className="not-prose w-full" table={table}>
          <DataTableContent aria-label="Orders by page" />
          <DataTablePagination pageSizes={[5, 10]} />
          <p className="text-sm text-muted-foreground">
            Query:{' '}
            <code>
              {new URLSearchParams({
                page: String(query.page),
                pageSize: String(query.pageSize),
                ...(query.sort !== undefined && { sort: query.sort }),
              }).toString()}
            </code>
          </p>
        </DataTable>
      );
    }

    // Stands in for an API: it sorts and slices 42 orders for the page asked.
    function fetchOrders({
      page,
      pageSize,
      sort,
    }: ReturnType<typeof dataTableQuery>) {
      const orders = Array.from({ length: 42 }, (_, index) => ({
        id: `ORD-${String(index + 1).padStart(3, '0')}`,
        total: ((index * 37) % 90) * 10 + 15,
      }));
      const compare = sorts.get(sort ?? '');
      if (compare) orders.sort(compare);
      const start = (page - 1) * pageSize;
      return {
        rowCount: orders.length,
        rows: orders.slice(start, start + pageSize),
      };
    }

    ```
  </TabsContent>
</Tabs>


### Loading, refetching, empty and errors [#loading-refetching-empty-and-errors]

`isLoading` shows skeleton rows for the first load, with a visually hidden
`loadingLabel` for screen readers. `isRefetching` keeps the rows on screen,
faded, while new ones load, such as with TanStack Query's
`placeholderData: keepPreviousData`. An `error` shows as an alert, which
can hold a retry button: above the rows when a refetch fails, so they stay
readable, or in place of them when the first load fails. The alert stays
through a retry, so focus on a retry button inside it stays put; when an
`isRefetching` retry ends with the error still set, the table announces
`retryFailedLabel` ("Retry failed"). Rows kept under
an error should be the current page's: data held over from another page or
order would sit under a pager and headers that no longer describe it. With
no rows the body says `emptyLabel`, or `noResultsLabel` while a filter is set.

```tsx
<DataTableContent
  aria-label="Payments"
  error={query.isError && 'Payments failed to load.'}
  isLoading={query.isPending}
  isRefetching={query.isPlaceholderData}
/>
```

### Column presets [#column-presets]

`selectionColumn` adds row checkboxes and a box for the page. `numberColumn`,
`currencyColumn` and `dateColumn` format values for the app's locale and align
numbers to the end. `actionsColumn` takes a cell per row, under a header
named for screen readers only. `linkColumn` puts a link in each row's heading
cell that covers the whole row, so a click anywhere opens it while the
checkbox and actions keep their own clicks; it suits a table whose first
column isn't sticky.

### Filters [#filters]

Filters ship as their own item, which adds a search, faceted filters and the
active filters:

<Tabs defaultValue="CLI">
  <TabsList>
    <TabsTrigger value="CLI">
      CLI
    </TabsTrigger>

    <TabsTrigger value="Manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="CLI">
    <CodeBlockTabs defaultValue="npm" groupId="package-manager" persist>
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="npm">
          npm
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="pnpm">
          pnpm
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="yarn">
          yarn
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="bun">
          bun
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="npm">
        ```bash
        npx shadcn@latest add @oakoss/data-table-filters
        ```
      </CodeBlockTab>

      <CodeBlockTab value="pnpm">
        ```bash
        pnpm dlx shadcn@latest add @oakoss/data-table-filters
        ```
      </CodeBlockTab>

      <CodeBlockTab value="yarn">
        ```bash
        yarn dlx shadcn@latest add @oakoss/data-table-filters
        ```
      </CodeBlockTab>

      <CodeBlockTab value="bun">
        ```bash
        bunx --bun shadcn@latest add @oakoss/data-table-filters
        ```
      </CodeBlockTab>
    </CodeBlockTabs>
  </TabsContent>

  <TabsContent value="Manual">
    <Steps>
      <Step>
        Set up the theme and base styles from [Installation](/docs/installation).
      </Step>

      <Step>
        Install the packages.

        <CodeBlockTabs defaultValue="npm" groupId="package-manager" persist>
          <CodeBlockTabsList>
            <CodeBlockTabsTrigger value="npm">
              npm
            </CodeBlockTabsTrigger>

            <CodeBlockTabsTrigger value="pnpm">
              pnpm
            </CodeBlockTabsTrigger>

            <CodeBlockTabsTrigger value="yarn">
              yarn
            </CodeBlockTabsTrigger>

            <CodeBlockTabsTrigger value="bun">
              bun
            </CodeBlockTabsTrigger>
          </CodeBlockTabsList>

          <CodeBlockTab value="npm">
            ```bash
            npm install @tanstack/react-table@^9 cn react-aria-components tailwind-variants
            ```
          </CodeBlockTab>

          <CodeBlockTab value="pnpm">
            ```bash
            pnpm add @tanstack/react-table@^9 cn react-aria-components tailwind-variants
            ```
          </CodeBlockTab>

          <CodeBlockTab value="yarn">
            ```bash
            yarn add @tanstack/react-table@^9 cn react-aria-components tailwind-variants
            ```
          </CodeBlockTab>

          <CodeBlockTab value="bun">
            ```bash
            bun add @tanstack/react-table@^9 cn react-aria-components tailwind-variants
            ```
          </CodeBlockTab>
        </CodeBlockTabs>
      </Step>

      <Step>
        Copy each file into your project, and change its `#/` imports to your aliases.

        * [`components/ui/data/badge.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/badge.tsx)

        * [`lib/recipes.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/recipes.ts)

        * [`lib/cx.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/cx.ts)

        * [`lib/cn-config.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/cn-config.ts)

        * [`components/ui/feedback/spinner.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/feedback/spinner.tsx)

        * [`components/icons.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/icons.tsx)

        * [`components/icon-placeholder.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/icon-placeholder.tsx)

        * [`components/ui/inputs/button.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/button.tsx)

        * [`components/ui/layout/separator.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/layout/separator.tsx)

        * [`components/ui/inputs/input.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/input.tsx)

        * [`components/ui/inputs/field.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/field.tsx)

        * [`lib/empty-node.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/empty-node.ts)

        * [`components/ui/inputs/checkbox.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/checkbox.tsx)

        * [`components/ui/overlays/dialog.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/dialog.tsx)

        * [`hooks/use-scroll-region.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-scroll-region.ts)

        * [`components/ui/overlays/popover.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/popover.tsx)

        * [`components/ui/overlays/dropdown-menu.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/dropdown-menu.tsx)

        * [`components/ui/overlays/menu.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/menu.tsx)

        * [`components/ui/overlays/menu-item.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/overlays/menu-item.tsx)

        * [`lib/empty-state.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/empty-state.ts)

        * [`lib/text-value.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/text-value.ts)

        * [`components/ui/inputs/input-group.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/input-group.tsx)

        * [`components/ui/inputs/select.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/select.tsx)

        * [`components/ui/inputs/list-box.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/list-box.tsx)

        * [`components/ui/feedback/skeleton.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/feedback/skeleton.tsx)

        * [`components/ui/data/table.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/table.tsx)

        * [`components/ui/data/data-table.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table.tsx)

        * [`components/ui/data/data-table-action-bar.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-action-bar.tsx)

        * [`components/ui/data/data-table-announcer.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-announcer.tsx)

        * [`components/ui/data/data-table-body.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-body.tsx)

        * [`components/ui/data/data-table-columns.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-columns.tsx)

        * [`components/ui/data/data-table-header.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-header.tsx)

        * [`components/ui/data/data-table-pagination.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-pagination.tsx)

        * [`components/ui/data/data-table-view-options.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-view-options.tsx)

        * [`hooks/use-data-table.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-data-table.ts)

        * [`hooks/use-data-table-filters.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-data-table-filters.ts)

        * [`hooks/use-data-table-selection.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-data-table-selection.ts)

        * [`hooks/use-data-table-state.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-data-table-state.ts)

        * [`hooks/use-latest.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/hooks/use-latest.ts)

        * [`lib/data-table-headers.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-headers.ts)

        * [`lib/data-table-query.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-query.ts)

        * [`lib/data-table-selection.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-selection.ts)

        * [`lib/data-table-state.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-state.ts)

        * [`lib/data-table-status.ts`](https://github.com/oakoss/ui/blob/main/packages/ui/src/lib/data-table-status.ts)

        * [`components/ui/inputs/search-field.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/inputs/search-field.tsx)

        * [`components/ui/data/tag-group.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/tag-group.tsx)

        * [`components/ui/data/data-table-faceted-filter.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-faceted-filter.tsx)

        * [`components/ui/data/data-table-filter-chips.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-filter-chips.tsx)

        * [`components/ui/data/data-table-search.tsx`](https://github.com/oakoss/ui/blob/main/packages/ui/src/components/ui/data/data-table-search.tsx)
      </Step>

      <Step>
        Add this CSS to your stylesheet.

        ```css
        @custom-variant linked (&[aria-current]:not([aria-current=false]));
        ```
      </Step>

      <Step>
        Replace each `<IconPlaceholder>` in `icons.tsx` with your icon library's icon, named in its props. The CLI does this for you; without it, icons render as empty squares.
      </Step>
    </Steps>
  </TabsContent>
</Tabs>


`DataTableSearch` filters the whole table, or one column with `column`, once
typing pauses (150ms, or 300ms when the server filters), and shows a change
the app makes to the search, such as from the URL. It matches the raw values,
not their formatting, so "$100" doesn't find an amount of 100.
`DataTableFacetedFilter` picks values from a column's `meta.options`, which it
requires; build them from the data when the values aren't known ahead. An
option's value is the cell's value as text, and a date's is its ISO string. Each
option shows a count that follows the other filters, and a column with options
keeps rows whose value equals a picked one. A column that names its own
`filterFn` receives the picked values as an array of strings. A server table
passes `counts` from its API, keyed by option value, since a page of rows
can't count the whole result. `DataTableFilterChips` shows one chip per
filtered column and a Reset button. A column takes one kind of filter: a
search or a facet, not both.

<Tabs defaultValue="Preview">
  <TabsList>
    <TabsTrigger value="Preview">
      Preview
    </TabsTrigger>

    <TabsTrigger value="Code">
      Code
    </TabsTrigger>
  </TabsList>

  <TabsContent value="Preview">
    <DataTableFilters />
  </TabsContent>

  <TabsContent value="Code">
    ```tsx
    import {
      DataTable,
      DataTableContent,
      DataTableToolbar,
    } from '#/components/ui/data/data-table';
    import { currencyColumn } from '#/components/ui/data/data-table-columns';
    import { DataTableFacetedFilter } from '#/components/ui/data/data-table-faceted-filter';
    import { DataTableFilterChips } from '#/components/ui/data/data-table-filter-chips';
    import { DataTablePagination } from '#/components/ui/data/data-table-pagination';
    import { DataTableSearch } from '#/components/ui/data/data-table-search';
    import {
      type DataTableColumn,
      useDataTable,
    } from '#/hooks/use-data-table';

    type Order = { customer: string; id: string; status: string; total: number };

    const orders: Order[] = [
      ['ORD-001', 'Ada Lovelace', 'shipped', 120],
      ['ORD-002', 'Grace Hopper', 'processing', 80],
      ['ORD-003', 'Alan Turing', 'cancelled', 45],
      ['ORD-004', 'Katherine Johnson', 'shipped', 210],
      ['ORD-005', 'Linus Torvalds', 'processing', 60],
      ['ORD-006', 'Margaret Hamilton', 'shipped', 150],
      ['ORD-007', 'Barbara Liskov', 'processing', 95],
      ['ORD-008', 'Dennis Ritchie', 'shipped', 30],
    ].map(([id, customer, status, total]) => ({
      customer: String(customer),
      id: String(id),
      status: String(status),
      total: Number(total),
    }));

    // Options in the column's meta name the faceted filter's values.
    const columns: DataTableColumn<Order>[] = [
      { accessorKey: 'id', header: 'Order', meta: { isRowHeader: true } },
      { accessorKey: 'customer', header: 'Customer' },
      {
        accessorKey: 'status',
        header: 'Status',
        meta: {
          options: [
            { label: 'Processing', value: 'processing' },
            { label: 'Shipped', value: 'shipped' },
            { label: 'Cancelled', value: 'cancelled' },
          ],
        },
      },
      currencyColumn<Order>('total', { currency: 'USD', header: 'Total' }),
    ];

    export function DataTableFilters() {
      const table = useDataTable({
        columns,
        data: orders,
        defaultState: { pagination: { pageIndex: 0, pageSize: 5 } },
      });
      return (
        <DataTable className="not-prose w-full" table={table}>
          <DataTableToolbar>
            <DataTableSearch aria-label="Search orders" placeholder="Search…" />
            <DataTableFacetedFilter column="status" />
          </DataTableToolbar>
          <DataTableFilterChips />
          <DataTableContent aria-label="Orders" />
          <DataTablePagination pageSizes={[5, 10]} />
        </DataTable>
      );
    }

    ```
  </TabsContent>
</Tabs>


### Selection and bulk actions [#selection-and-bulk-actions]

`DataTableActionBar` appears while rows are selected, with the count, Clear,
and the actions you pass as children. It sits after the table and sticks to
the bottom of the screen, so ticking the first row moves only what follows.
Once a page's rows are all ticked and more rows match, it offers to select
every matching row; a server table counts those from `rowCount`. A new filter
or search ends that selection, while sorting and paging keep it. A client
table notes selected rows a filter hides; a server table can't tell those
from rows on another page.

The `selection` slice is `{ ids }`, or `{ all, except }` for every row
matching `all`, the filters and search it was made under, apart from the
`except` ids. A server action receives the selection and applies `all` when
it runs, so it acts on the rows matching then; its own rules decide which
rows it may change, as `enableRowSelection` does on the page. A client action
reads the rows with `selectedRows(table)`. Confirm a destructive action with
the count in an [Alert Dialog](/docs/components/alert-dialog), which focuses
Cancel, and keep the rows that failed selected:

<Tabs defaultValue="Preview">
  <TabsList>
    <TabsTrigger value="Preview">
      Preview
    </TabsTrigger>

    <TabsTrigger value="Code">
      Code
    </TabsTrigger>
  </TabsList>

  <TabsContent value="Preview">
    <DataTableBulkActions />
  </TabsContent>

  <TabsContent value="Code">
    ```tsx
    import {
      DataTable,
      DataTableContent,
      DataTableToolbar,
    } from '#/components/ui/data/data-table';
    import { DataTableActionBar } from '#/components/ui/data/data-table-action-bar';
    import { selectionColumn } from '#/components/ui/data/data-table-columns';
    import { DataTablePagination } from '#/components/ui/data/data-table-pagination';
    import { DataTableSearch } from '#/components/ui/data/data-table-search';
    import { Alert, AlertTitle } from '#/components/ui/feedback/alert';
    import { Button } from '#/components/ui/inputs/button';
    import {
      AlertDialog,
      AlertDialogAction,
      AlertDialogCancel,
      AlertDialogFooter,
      AlertDialogHeader,
      AlertDialogTitle,
      AlertDialogTrigger,
    } from '#/components/ui/overlays/alert-dialog';
    import {
      type DataTableColumn,
      type DataTableSelection,
      type DataTableState,
      useDataTable,
    } from '#/hooks/use-data-table';
    import { selectionTest } from '#/lib/data-table-selection';
    import { useState } from 'react';

    type Invoice = { id: string; status: 'draft' | 'sent' };

    type Result = { deleted: number; refused: number; requested: number };

    type TableState = Pick<
      DataTableState,
      'globalFilter' | 'pagination' | 'selection'
    >;

    const columns: DataTableColumn<Invoice>[] = [
      selectionColumn<Invoice>({ rowLabel: (row) => `Select ${row.original.id}` }),
      { accessorKey: 'id', header: 'Invoice', meta: { isRowHeader: true } },
      { accessorKey: 'status', header: 'Status' },
    ];

    const invoices: Invoice[] = Array.from({ length: 12 }, (_, index) => ({
      id: `INV-${String(index + 1).padStart(3, '0')}`,
      status: index % 4 === 0 ? 'sent' : 'draft',
    }));

    export function DataTableBulkActions() {
      const [rows, setRows] = useState(invoices);
      const [result, setResult] = useState<Result>();
      const [state, set] = useTableState();
      const matching = search(rows, state.globalFilter);
      const { pageIndex, pageSize } = state.pagination;
      const table = useDataTable({
        columns,
        data: matching.slice(pageIndex * pageSize, (pageIndex + 1) * pageSize),
        enableRowSelection: true,
        getRowId: (row) => row.id,
        mode: 'server',
        onGlobalFilterChange: (globalFilter) => set({ globalFilter }),
        onPaginationChange: (pagination) => set({ pagination }),
        onSelectionChange: (selection) => set({ selection }),
        rowCount: matching.length,
        state,
      });

      function remove(selection: DataTableSelection, requested: number) {
        const { deleted, refused } = deleteInvoices(rows, selection);
        setRows((all) => all.filter((row) => !deleted.includes(row.id)));
        setResult({ deleted: deleted.length, refused: refused.length, requested });
        // Refused rows stay selected, and the page steps back if it emptied.
        const left = matching.filter((row) => !deleted.includes(row.id)).length;
        const last = Math.ceil(left / pageSize) - 1;
        const page = Math.max(Math.min(pageIndex, last), 0);
        set({
          pagination: { pageIndex: page, pageSize },
          selection: { ids: refused },
        });
      }

      return (
        <DataTable className="not-prose w-full" table={table}>
          <DataTableToolbar>
            <DataTableSearch aria-label="Search invoices" />
          </DataTableToolbar>
          {result ? <ResultAlert result={result} /> : null}
          <DataTableContent aria-label="Invoices" />
          <DeleteBar onDelete={remove} />
          <DataTablePagination pageSizes={[5, 10]} />
        </DataTable>
      );
    }

    function DeleteBar({
      onDelete,
    }: {
      onDelete: (selection: DataTableSelection, count: number) => void;
    }) {
      return (
        <DataTableActionBar>
          {({ selected, selection }) => (
            <AlertDialogTrigger>
              <Button intent="destructive" size="sm">
                Delete
              </Button>
              <AlertDialog>
                <AlertDialogHeader>
                  <AlertDialogTitle>
                    Delete {selected} {selected === 1 ? 'invoice' : 'invoices'}?
                  </AlertDialogTitle>
                </AlertDialogHeader>
                <AlertDialogFooter>
                  <AlertDialogCancel>Cancel</AlertDialogCancel>
                  <AlertDialogAction
                    intent="destructive"
                    onAction={() => onDelete(selection, selected)}
                  >
                    Delete {selected}
                  </AlertDialogAction>
                </AlertDialogFooter>
              </AlertDialog>
            </AlertDialogTrigger>
          )}
        </DataTableActionBar>
      );
    }

    // Stands in for an API: it applies the selection's saved search itself, so
    // "all" means every invoice matching it apart from the exceptions, and it
    // refuses sent invoices.
    function deleteInvoices(rows: Invoice[], selection: DataTableSelection) {
      const pool =
        selection.all === undefined
          ? rows
          : search(rows, selection.all.search ?? '');
      const isPicked = selectionTest(selection);
      const targets = pool.filter((row) => isPicked(row.id));
      return {
        deleted: targets
          .filter((row) => row.status === 'draft')
          .map((row) => row.id),
        refused: targets
          .filter((row) => row.status === 'sent')
          .map((row) => row.id),
      };
    }

    function invoiceCount(count: number) {
      return `${String(count)} ${count === 1 ? 'invoice was' : 'invoices were'}`;
    }

    // Any shortfall from the count confirmed is a failure, rows already gone
    // included.
    function ResultAlert({ result }: { result: Result }) {
      const { deleted, refused, requested } = result;
      const gone = requested - deleted - refused;
      return (
        <Alert
          intent={deleted < requested ? 'destructive' : 'success'}
          role={deleted < requested ? 'alert' : 'status'}
        >
          <AlertTitle>
            {`Deleted ${String(deleted)} of ${String(requested)}.`}
            {refused > 0 ? ` ${invoiceCount(refused)} sent, so not deleted.` : ''}
            {gone > 0 ? ` ${invoiceCount(gone)} already gone.` : ''}
          </AlertTitle>
        </Alert>
      );
    }

    function search(rows: Invoice[], text: string) {
      const query = text.trim().toLowerCase();
      return rows.filter((row) => row.id.toLowerCase().includes(query));
    }

    function useTableState() {
      const [state, setState] = useState<TableState>({
        globalFilter: '',
        pagination: { pageIndex: 0, pageSize: 5 },
        selection: { ids: [] },
      });
      const set = (next: Partial<TableState>) =>
        setState((previous) => ({ ...previous, ...next }));
      return [state, set] as const;
    }

    ```
  </TabsContent>
</Tabs>


### Linking to a row [#linking-to-a-row]

`linkedRowId` marks the row a link points to, such as `?payment=PAY-014` in
the URL. On client data it brings up that row's page, scrolls the row into
view and focuses its row header, once per link, so paging away afterwards
stays put. With server data, fetch the page holding the row yourself.

## Accessibility [#accessibility]

DataTable renders [Table](/docs/components/table)'s native table elements,
following the
[WAI-ARIA table pattern](https://www.w3.org/WAI/ARIA/apg/patterns/table/), with
each control inside a tab stop of its own. Name the table with `aria-label`
or `aria-labelledby` on `DataTableContent`.

A sortable column's header holds a button: each press sorts ascending,
descending, then unsorted, and Shift adds the column to the order instead of
replacing it. The first sort column's header carries `aria-sort`, which ARIA
allows on one header at a time; later ones show their place in the order.

Selected rows carry `aria-selected` and their checkbox is checked. Shift with
a click or Space selects the range from the last row pressed. The header box
selects the page's rows, and reads mixed while only some are selected. The
action bar is a [toolbar](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/)
named "Selected rows", after the table in the reading order; `Escape` inside
it clears the selection. When it goes, focus left in it moves to the header
box, or with no rows left, to the table's first control. Controls in the table keep a bottom scroll margin, so focus scrolled
into view stays clear of the bar.

While a page holds part of the result, the table carries `aria-rowcount` and
each row `aria-rowindex`, so screen readers say where a row sits in the
whole. Sorting, paging, filtering and selecting change the table without
moving focus, so a polite live region says what changed, such as "Sorted by
Amount, ascending". The table is busy (`aria-busy`) while loading or
refetching.

A faceted filter is a [Select](/docs/components/select) with multiple
selection, so its list follows the
[WAI-ARIA listbox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/):
each option is named by its label and reads its count as its description,
and the trigger's name includes how many values are chosen. Past seven
options a search field leads the list and takes focus as it opens. The
active filters are a [Tag Group](/docs/components/tag-group), whose tags
remove with `Delete` or `Backspace`. Clearing every filter, from Reset or the
no-results state, moves focus to the search field.

| Key                    | Action                                             |
| ---------------------- | -------------------------------------------------- |
| `Tab`                  | Moves to the next control in the table             |
| `Enter` or `Space`     | On a header button, steps the sort                 |
| `Shift` + `Enter`      | On a header button, adds the column to the sort    |
| `Space`                | On a row checkbox, selects or clears the row       |
| `Shift` + `Space`      | On a row checkbox, selects the range from the last |
| `Arrow Up` / `Down`    | In a faceted filter's list, moves between options  |
| `Enter` or `Space`     | In a faceted filter's list, chooses or clears one  |
| `Delete` / `Backspace` | On an active filter, removes it                    |
| `Arrow Left` / `Right` | In the action bar, moves between its controls      |
| `Escape`               | In the action bar, clears the selection            |

Every string is a prop with an English default: the labels on
`DataTableContent`, `DataTableActionBar`, `DataTablePagination`,
`DataTableViewOptions` and the column presets, and the announcements through
`DataTable`'s `messages`.

## API [#api]

### DataTable [#datatable]

A `div` that holds the table for the parts inside it and its live region.

#### Props [#props]

| Prop        | Type                         | Description |
| ----------- | ---------------------------- | ----------- |
| `messages?` | `Partial<DataTableMessages>` |             |
| `table`     | `DataTableInstance<TData>`   |             |

Also accepts `div` props.

### DataTableContent [#datatablecontent]

[Table](/docs/components/table) with the table's header and rows.

#### Props [#props-1]

| Prop                 | Type             | Description |
| -------------------- | ---------------- | ----------- |
| `error?`             | `DataTableError` |             |
| `isLoading?`         | `union`          |             |
| `isRefetching?`      | `union`          |             |
| `linkedRowId?`       | `string`         |             |
| `retryFailedLabel?`  | `string`         |             |
| `clearFiltersLabel?` | `string`         |             |
| `emptyLabel?`        | `ReactNode`      |             |
| `loadingLabel?`      | `string`         |             |
| `noResultsLabel?`    | `ReactNode`      |             |

Also accepts [Table](/docs/components/table)'s props.

### DataTableActionBar [#datatableactionbar]

A React Aria [Toolbar](https://react-aria.adobe.com/Toolbar) with the
selected count, Clear and your actions; it renders nothing while nothing is
selected. `children` can be a function of the selection and its counts.

#### Props [#props-2]

| Prop                | Type       | Description |
| ------------------- | ---------- | ----------- |
| `allSelectedLabel?` | `function` |             |
| `children?`         | `union`    |             |
| `className?`        | `string`   |             |
| `clearLabel?`       | `string`   |             |
| `hiddenLabel?`      | `function` |             |
| `label?`            | `string`   |             |
| `selectAllLabel?`   | `function` |             |
| `selectedLabel?`    | `function` |             |

Also accepts React Aria Toolbar's props.

### DataTablePagination [#datatablepagination]

A page size select, the page and step buttons.

#### Props [#props-3]

| Prop             | Type       | Description |
| ---------------- | ---------- | ----------- |
| `firstLabel?`    | `string`   |             |
| `lastLabel?`     | `string`   |             |
| `nextLabel?`     | `string`   |             |
| `pageLabel?`     | `function` |             |
| `pageSizeLabel?` | `string`   |             |
| `pageSizes?`     | `array`    |             |
| `previousLabel?` | `string`   |             |

Also accepts `div` props.

### DataTableViewOptions [#datatableviewoptions]

A [Dropdown Menu](/docs/components/dropdown-menu) that shows and hides the
data columns that can hide.

#### Props [#props-4]

| Prop     | Type     | Description |
| -------- | -------- | ----------- |
| `label?` | `string` |             |

### DataTableToolbar [#datatabletoolbar]

A `div` that lays out controls above the table, such as filters and the
column menu, accepting `div` props.

### DataTableSearch [#datatablesearch]

A [Search Field](/docs/components/search-field) that filters the table, from
the `data-table-filters` item.

#### Props [#props-5]

| Prop            | Type                         | Description |
| --------------- | ---------------------------- | ----------- |
| `column?`       | `string`                     |             |
| `debounceMs?`   | `number`                     |             |
| `children?`     | `union`                      |             |
| `description?`  | `ReactNode`                  |             |
| `end?`          | `ReactNode`                  |             |
| `errorMessage?` | `ChildrenOrFunction<object>` |             |
| `errors?`       | `array`                      |             |
| `label?`        | `ReactNode`                  |             |
| `placeholder?`  | `string`                     |             |
| `size?`         | `union`                      |             |
| `start?`        | `ReactNode`                  |             |

Also accepts [Search Field](/docs/components/search-field)'s props, except
its value.

### DataTableFacetedFilter [#datatablefacetedfilter]

A multiple-selection [Select](/docs/components/select) that filters a column
to the values chosen, from the `data-table-filters` item.

#### Props [#props-6]

| Prop               | Type                               | Description |
| ------------------ | ---------------------------------- | ----------- |
| `column`           | `string`                           |             |
| `counts?`          | `Readonly<Record<string, number>>` |             |
| `emptyLabel?`      | `string`                           |             |
| `searchLabel?`     | `string`                           |             |
| `searchThreshold?` | `number`                           |             |
| `selectedLabel?`   | `function`                         |             |
| `title?`           | `string`                           |             |

### DataTableFilterChips [#datatablefilterchips]

A [Tag Group](/docs/components/tag-group) of the active filters and a Reset
button, from the `data-table-filters` item; it renders nothing while nothing
is filtered.

#### Props [#props-7]

| Prop          | Type     | Description |
| ------------- | -------- | ----------- |
| `label?`      | `string` |             |
| `resetLabel?` | `string` |             |

Also accepts `div` props.

### Data attributes [#data-attributes]

| Attribute   | Present when                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data-slot` | Always: `data-table`, `data-table-toolbar`, `data-table-head`, `data-table-sort`, `data-table-body`, `data-table-row`, `data-table-action-bar`, `data-table-action-bar-clear`, `data-table-pagination`, `data-table-view-options`, `data-table-announcer`, `data-table-faceted-filter` or `data-table-filter-chips`; `data-table-error` on the alert row above kept rows; `data-table-retry` on the visually hidden region that announces a failed retry |
