> For AI agents: the complete documentation index is available at https://wallarm.github.io/design-system/llms.txt, the full documentation bundle is available at https://wallarm.github.io/design-system/llms-full.txt.

# Entity table

**Components:** [`Table`](https://wallarm.github.io/design-system/components/table.md), [`TableActionBar`](https://wallarm.github.io/design-system/components/table.md), [`TableActionBarSelection`](https://wallarm.github.io/design-system/components/table.md), [`TableEmptyState`](https://wallarm.github.io/design-system/components/table.md), [`Badge`](https://wallarm.github.io/design-system/components/badge.md), [`Tag`](https://wallarm.github.io/design-system/components/tag.md), [`OverflowList`](https://wallarm.github.io/design-system/components/overflow-list.md), [`Avatar`](https://wallarm.github.io/design-system/components/avatar.md)


+11 more

[`AvatarContent`](https://wallarm.github.io/design-system/components/avatar.md), [`AvatarName`](https://wallarm.github.io/design-system/components/avatar.md), [`AvatarDescription`](https://wallarm.github.io/design-system/components/avatar.md), [`Code`](https://wallarm.github.io/design-system/components/code.md), [`FormatDateTime`](https://wallarm.github.io/design-system/components/format-date-time.md), [`DropdownMenu`](https://wallarm.github.io/design-system/components/dropdown-menu.md), [`DropdownMenuItem`](https://wallarm.github.io/design-system/components/dropdown-menu.md), [`Button`](https://wallarm.github.io/design-system/components/button.md), [`Tooltip`](https://wallarm.github.io/design-system/components/tooltip.md), [`Switch`](https://wallarm.github.io/design-system/components/switch.md), [`EmptyState`](https://wallarm.github.io/design-system/components/empty-state.md)

One `Table` with a fixed cell vocabulary, a row menu in the master cell and a bulk bar.

## When to use

| Need                         | Use                                                                                             | Not                                                      |
| ---------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| A list of entities on a page | `Table` inside `PageContent`                                                                    | A `div` grid, a `Card` per row                           |
| A list in a drawer or dialog | The same `Table` inside `DrawerBody` or `DialogBody` (from `@wallarm-org/design-system/Dialog`) | A custom bordered list                                   |
| Actions on one row           | `meta.renderMenuAction` on the master (first) column                                            | A trailing actions column, buttons repeated in every row |
| Actions on many rows         | `onRowSelectionChange` plus `TableActionBar`                                                    | Your own floating bar                                    |
| Details of one entity        | `Attribute` in a drawer                                                                         | A two-column `Table`                                     |
| Kanban, preference matrix    | Product code                                                                                    | This pattern                                             |

Use only these cells.

| Data           | Cell                                              | Not                       |
| -------------- | ------------------------------------------------- | ------------------------- |
| Person         | `Avatar size='md'` with `AvatarName`              | `img` plus `span`         |
| Second line    | `AvatarDescription`                               | Two `Text` lines          |
| Status         | `Badge variant='dotted' type='secondary' color=…` | Colored text, a raw dot   |
| Locked row     | `Badge` with `Lock` in a `Tooltip`                | A bare lock icon          |
| Groups, roles  | `OverflowList` of `Tag`                           | Joined text, custom "+N"  |
| ID, key, hash  | `Code size='m'`                                   | A monospace `span`        |
| Recent time    | `FormatDateTime format='relative'`                | `toLocaleString()`        |
| Exact time     | `FormatDateTime format='datetime'`                | Two cells                 |
| Count, metric  | The raw number                                    | `meta.align`              |
| On/off setting | `Switch` with `SwitchControl`                     | `Checkbox`                |
| Missing value  | `'—'` (em dash)                                   | `0`, `N/A`, an empty cell |

## Rules

**Layout and spacing**

- The first column is pinned and never hideable: put the entity name there.
- `Table` owns its frame, borders, padding and header. **Never** wrap it in a bordered `div` or restyle cells via `meta.cellClassName`.
- `PageContent`, `DrawerBody` and `DialogBody` own the gutter. **Never** add `p-24` or any padding around `Table`.
- Set widths with `size`: name `320`, email `240`, status `140`, timestamp `200` (the default minimum is 96px).
- If columns must keep their `size`, pass `stretch={false}`.
- Two-line cell: add a `Text size='xs' color='secondary'` line; there is no `rowHeight`.

**Row menu**

- Every contextual row action goes through the master cell: `meta: { renderMenuAction }` on the first column. Its `…` shows on row hover, while the menu is open and on the previewed row.
- **Never** add a trailing actions column or buttons in cells. There is no `actions` column type or `alwaysShowMenu`.
- Trigger: `Button variant='ghost' color='neutral' size='small'`, `Ellipsis` icon, `aria-label` naming the row.
- Order items: open, edit, reorder, state changes, `DropdownMenuSeparator`, destructive.
- Use `variant='destructive'` and name the entity: "Delete user", not "Delete". Confirm before deleting.
- Inherited or read-only row: only view and "Open at \{scope}".

**Data and selection**

- Always pass `getRowId={row => row.id}`; selection, `activeRowId` and reordering key on it.
- For selection, pass `rowSelection` and `onRowSelectionChange`; without the handler there are no checkboxes.
- Sorting: `sorting` and `onSortingChange`, plus `manualSorting` if the server sorts.
- Bulk actions: `Button variant='ghost' color='neutral-alt'` in `TableActionBar`; destructive last with `color='destructive'`; options go in a `DropdownMenu`.
- Custom selection text: `TableActionBarSelection` (from `@wallarm-org/design-system/Table`) with `BulkBarSummaryCount`, `BulkBarSummarySelectAll`, `BulkBarSummaryClear` as direct children.
- Drag to reorder: `onRowReorder`; pin rows with `getRowCanDrag`.

**Values**

- Status `color`: Active, Enabled, Connected `green`; Invited, Pending, Needs attention `yellow`; Expired, Failed, Error `red`; Deactivated, Disabled, Draft `gray`. `Badge` has no `status` prop.
- **Never** show `0` for missing data; show `'—'`. `FormatDateTime` renders `—` for `null` itself.
- **Never** set `meta.align` on numbers; they align right on their own. If the first row can be `null` or `'—'`, set `meta: { sortType: 'number' }`.
- Header explanation: `meta.description: { type: 'tooltip', content }`; `type: 'text'` keeps it visible.
- Import `OverflowList` from `@wallarm-org/design-system/OverflowList`; pass it a stable `items` array (`row.original.groups`). There is no `maxItems`.
- Tests: pass `data-testid` to `Table`; **never** select by `data-slot`.

## Examples

The whole table: the cell vocabulary, the row menu in the master cell, sorting and a bulk bar for selected rows.

Adds an ID in `Code` and an exact time to the `Cells` vocabulary. Sort by any header; select
rows to bring up the bulk bar.

```tsx
import { useState } from 'react';
import { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarName } from '@wallarm-org/design-system/Avatar';
import { Badge } from '@wallarm-org/design-system/Badge';
import { Button } from '@wallarm-org/design-system/Button';
import { Code } from '@wallarm-org/design-system/Code';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
import { Ellipsis, Trash2 } from '@wallarm-org/design-system/icons';
import { OverflowList } from '@wallarm-org/design-system/OverflowList';
import { Page, PageContent } from '@wallarm-org/design-system/Page';
import { type TableCellContext, type TableColumnDef, type TableRow, type TableRowSelectionState, type TableSortingState, Table, TableActionBar } from '@wallarm-org/design-system/Table';
import { Tag } from '@wallarm-org/design-system/Tag';

export const Default = () => {
  const [sorting, setSorting] = useState<TableSortingState>([]);
  const [selection, setSelection] = useState<TableRowSelectionState>({});

  const STATUS = {
    active: { label: 'Active', color: 'green' },
    invited: { label: 'Invited', color: 'yellow' },
    expired: { label: 'Expired', color: 'red' },
    deactivated: { label: 'Deactivated', color: 'gray' },
  } as const;

  const renderGroup = (group: string) => <Tag key={group}>{group}</Tag>;

  const renderUser = ({ row }: TableCellContext<User, unknown>) => (
    <Avatar size='md'>
      <AvatarFallback name={row.original.name} />
      <AvatarContent>
        <AvatarName>{row.original.name}</AvatarName>
        <AvatarDescription>{row.original.email}</AvatarDescription>
      </AvatarContent>
    </Avatar>
  );

  const renderId = ({ row }: TableCellContext<User, unknown>) => (
    <Code size='m'>{row.original.id}</Code>
  );

  const renderGroups = ({ row }: TableCellContext<User, unknown>) =>
    row.original.groups.length > 0 ? (
      <OverflowList className='gap-4' items={row.original.groups} itemRenderer={renderGroup} />
    ) : (
      '—'
    );

  const renderStatus = ({ row }: TableCellContext<User, unknown>) => (
    <Badge variant='dotted' type='secondary' color={STATUS[row.original.status].color}>
      {STATUS[row.original.status].label}
    </Badge>
  );

  const renderLastSignIn = ({ row }: TableCellContext<User, unknown>) => (
    <FormatDateTime value={row.original.lastSignIn} format='datetime' />
  );

  const renderRequests = ({ row }: TableCellContext<User, unknown>) => row.original.requests ?? '—';

  const renderMenuAction = (row: TableRow<User>) => {
    const user = row.original;
    const handleEdit = () => onEditUser(user);
    const handleResend = () => onResendInvite(user);
    const handleDeactivate = () => onDeactivateUser(user);
    const handleDelete = () => onDeleteUser(user);

    return (
      <DropdownMenu data-testid='users-row-menu'>
        <DropdownMenuTrigger asChild>
          <Button
            variant='ghost'
            color='neutral'
            size='small'
            aria-label={`Actions for ${user.name}`}
          >
            <Ellipsis />
          </Button>
        </DropdownMenuTrigger>
        <DropdownMenuContent>
          <DropdownMenuItem onSelect={handleEdit}>
            <DropdownMenuItemText>Edit</DropdownMenuItemText>
          </DropdownMenuItem>
          {user.status === 'invited' && (
            <DropdownMenuItem onSelect={handleResend}>
              <DropdownMenuItemText>Resend invite</DropdownMenuItemText>
            </DropdownMenuItem>
          )}
          <DropdownMenuItem onSelect={handleDeactivate}>
            <DropdownMenuItemText>Deactivate</DropdownMenuItemText>
          </DropdownMenuItem>
          <DropdownMenuSeparator />
          <DropdownMenuItem variant='destructive' onSelect={handleDelete}>
            <DropdownMenuItemText>Delete user</DropdownMenuItemText>
          </DropdownMenuItem>
        </DropdownMenuContent>
      </DropdownMenu>
    );
  };

  const columns: TableColumnDef<User>[] = [
    {
      accessorKey: 'name',
      header: 'Name',
      size: 320,
      cell: renderUser,
      meta: { renderMenuAction },
    },
    { accessorKey: 'id', header: 'User ID', size: 160, cell: renderId },
    {
      accessorKey: 'groups',
      header: 'Groups',
      size: 240,
      enableSorting: false,
      cell: renderGroups,
    },
    { accessorKey: 'status', header: 'Status', size: 140, cell: renderStatus },
    { accessorKey: 'lastSignIn', header: 'Last sign-in', size: 200, cell: renderLastSignIn },
    {
      accessorKey: 'requests',
      header: 'API requests',
      size: 140,
      meta: { sortType: 'number', description: { type: 'tooltip', content: 'Last 24 hours' } },
      cell: renderRequests,
    },
  ];

  const handleAssignGroup = () => onAssignGroup(Object.keys(selection));
  const handleBulkDelete = () => onBulkDelete(Object.keys(selection));

  return (
    <Page name='settings-users' fullSize fixedHeight data-testid='users-page'>
      <PageContent>
        <Table
          aria-label='Users'
          data={USERS}
          columns={columns}
          getRowId={getUserId}
          sorting={sorting}
          onSortingChange={setSorting}
          rowSelection={selection}
          onRowSelectionChange={setSelection}
          data-testid='users-table'
        >
          <TableActionBar>
            <Button variant='ghost' color='neutral-alt' onClick={handleAssignGroup}>
              Assign group
            </Button>
            <Button color='destructive' onClick={handleBulkDelete} data-testid='users-bulk-delete'>
              <Trash2 /> Delete
            </Button>
          </TableActionBar>
        </Table>
      </PageContent>
    </Page>
  );
};
```

A person with a second line, a status badge, groups as tags, and a number whose header explains it.

Tags collapse into "+N" when the column runs out of room; a user with no groups or no requests
shows `—`.

```tsx
import { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarName } from '@wallarm-org/design-system/Avatar';
import { Badge } from '@wallarm-org/design-system/Badge';
import { OverflowList } from '@wallarm-org/design-system/OverflowList';
import { Page, PageContent } from '@wallarm-org/design-system/Page';
import { type TableCellContext, type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
import { Tag } from '@wallarm-org/design-system/Tag';

export const Cells = () => {
  const STATUS = {
    active: { label: 'Active', color: 'green' },
    invited: { label: 'Invited', color: 'yellow' },
    expired: { label: 'Expired', color: 'red' },
    deactivated: { label: 'Deactivated', color: 'gray' },
  } as const;

  const renderGroup = (group: string) => <Tag key={group}>{group}</Tag>;

  const renderUser = ({ row }: TableCellContext<User, unknown>) => (
    <Avatar size='md'>
      <AvatarFallback name={row.original.name} />
      <AvatarContent>
        <AvatarName>{row.original.name}</AvatarName>
        <AvatarDescription>{row.original.email}</AvatarDescription>
      </AvatarContent>
    </Avatar>
  );

  const renderStatus = ({ row }: TableCellContext<User, unknown>) => (
    <Badge variant='dotted' type='secondary' color={STATUS[row.original.status].color}>
      {STATUS[row.original.status].label}
    </Badge>
  );

  const renderGroups = ({ row }: TableCellContext<User, unknown>) =>
    row.original.groups.length > 0 ? (
      <OverflowList className='gap-4' items={row.original.groups} itemRenderer={renderGroup} />
    ) : (
      '—'
    );

  const renderRequests = ({ row }: TableCellContext<User, unknown>) => row.original.requests ?? '—';

  const columns: TableColumnDef<User>[] = [
    { accessorKey: 'name', header: 'Name', size: 320, cell: renderUser },
    { accessorKey: 'status', header: 'Status', size: 140, cell: renderStatus },
    {
      accessorKey: 'groups',
      header: 'Groups',
      size: 240,
      enableSorting: false,
      cell: renderGroups,
    },
    {
      accessorKey: 'requests',
      header: 'API requests',
      size: 140,
      meta: { sortType: 'number', description: { type: 'tooltip', content: 'Last 24 hours' } },
      cell: renderRequests,
    },
  ];

  return (
    <Page name='settings-users' data-testid='users-page'>
      <PageContent>
        <Table
          aria-label='Users'
          data={USERS}
          columns={columns}
          getRowId={getUserId}
          data-testid='users-table'
        />
      </PageContent>
    </Page>
  );
};
```

The row menu: the trigger names the row, and the destructive item comes last and names the entity.

Hover a row: the `…` appears in the master cell, `meta.renderMenuAction` on the first column. The
trigger names the row and the destructive item comes last.

```tsx
import { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarName } from '@wallarm-org/design-system/Avatar';
import { Button } from '@wallarm-org/design-system/Button';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
import { Ellipsis } from '@wallarm-org/design-system/icons';
import { Page, PageContent } from '@wallarm-org/design-system/Page';
import { type TableCellContext, type TableColumnDef, type TableRow, Table } from '@wallarm-org/design-system/Table';

export const RowMenu = () => {
  const renderUser = ({ row }: TableCellContext<User, unknown>) => (
    <Avatar size='md'>
      <AvatarFallback name={row.original.name} />
      <AvatarContent>
        <AvatarName>{row.original.name}</AvatarName>
        <AvatarDescription>{row.original.email}</AvatarDescription>
      </AvatarContent>
    </Avatar>
  );

  const renderMenuAction = (row: TableRow<User>) => {
    const user = row.original;
    const handleEdit = () => onEditUser(user);
    const handleDeactivate = () => onDeactivateUser(user);
    const handleDelete = () => onDeleteUser(user);

    return (
      <DropdownMenu data-testid='users-row-menu'>
        <DropdownMenuTrigger asChild>
          <Button
            variant='ghost'
            color='neutral'
            size='small'
            aria-label={`Actions for ${user.name}`}
          >
            <Ellipsis />
          </Button>
        </DropdownMenuTrigger>
        <DropdownMenuContent>
          <DropdownMenuItem onSelect={handleEdit}>
            <DropdownMenuItemText>Edit</DropdownMenuItemText>
          </DropdownMenuItem>
          <DropdownMenuItem onSelect={handleDeactivate}>
            <DropdownMenuItemText>Deactivate</DropdownMenuItemText>
          </DropdownMenuItem>
          <DropdownMenuSeparator />
          <DropdownMenuItem variant='destructive' onSelect={handleDelete}>
            <DropdownMenuItemText>Delete user</DropdownMenuItemText>
          </DropdownMenuItem>
        </DropdownMenuContent>
      </DropdownMenu>
    );
  };

  const columns: TableColumnDef<User>[] = [
    {
      accessorKey: 'name',
      header: 'Name',
      size: 320,
      cell: renderUser,
      meta: { renderMenuAction },
    },
  ];

  return (
    <Page name='settings-users' data-testid='users-page'>
      <PageContent>
        <Table
          aria-label='Users'
          data={USERS}
          columns={columns}
          getRowId={getUserId}
          data-testid='users-table'
        />
      </PageContent>
    </Page>
  );
};
```

First load keeps the header and fills the body with placeholder rows.

`isLoading` draws the skeleton rows, not a `Loader`; `skeletonCount` sets how many (12 by
default).

```tsx
import { Page, PageContent } from '@wallarm-org/design-system/Page';
import { type TableColumnDef, Table } from '@wallarm-org/design-system/Table';

export const Loading = () => {
  const columns: TableColumnDef<User>[] = [
    { accessorKey: 'name', header: 'Name', size: 320 },
    { accessorKey: 'id', header: 'User ID', size: 160 },
    { accessorKey: 'groups', header: 'Groups', size: 240 },
    { accessorKey: 'status', header: 'Status', size: 140 },
    { accessorKey: 'lastSignIn', header: 'Last sign-in', size: 200 },
  ];

  return (
    <Page name='settings-users' fullSize fixedHeight data-testid='users-page'>
      <PageContent>
        <Table
          aria-label='Users'
          data={[]}
          columns={columns}
          getRowId={getUserId}
          isLoading
          skeletonCount={6}
          data-testid='users-table'
        />
      </PageContent>
    </Page>
  );
};
```

Nothing created yet: an empty state under the header.

`EmptyState type='collection-empty'` inside `TableEmptyState`. It has no button when the page
header already has Create.

```tsx
import { EmptyState, EmptyStateDescription, EmptyStateIllustration, EmptyStateMessage, EmptyStateTitle } from '@wallarm-org/design-system/EmptyState';
import { UserPlus } from '@wallarm-org/design-system/icons';
import { Page, PageContent } from '@wallarm-org/design-system/Page';
import { type TableColumnDef, Table, TableEmptyState } from '@wallarm-org/design-system/Table';

export const Empty = () => {
  const columns: TableColumnDef<User>[] = [
    { accessorKey: 'name', header: 'Name', size: 320 },
    { accessorKey: 'id', header: 'User ID', size: 160 },
    { accessorKey: 'groups', header: 'Groups', size: 240 },
    { accessorKey: 'status', header: 'Status', size: 140 },
    { accessorKey: 'lastSignIn', header: 'Last sign-in', size: 200 },
  ];

  return (
    <Page name='settings-users' fullSize fixedHeight data-testid='users-page'>
      <PageContent>
        <Table
          aria-label='Users'
          data={[]}
          columns={columns}
          getRowId={getUserId}
          data-testid='users-table'
        >
          <TableEmptyState>
            <EmptyState type='collection-empty' data-testid='users-empty-state'>
              <EmptyStateIllustration>
                <UserPlus />
              </EmptyStateIllustration>
              <EmptyStateMessage>
                <EmptyStateTitle>No users yet</EmptyStateTitle>
                <EmptyStateDescription>
                  Invite people to sign in to your organization.
                </EmptyStateDescription>
              </EmptyStateMessage>
            </EmptyState>
          </TableEmptyState>
        </Table>
      </PageContent>
    </Page>
  );
};
```

## States

| State                | Show                                                                                                                               | Example component  |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| First load           | `isLoading` (12 skeleton rows; `skeletonCount`), not a `Loader`                                                                    | `Table`            |
| Nothing created      | `EmptyState type='collection-empty'`; no button if `PageActions` has Create; keep header and toolbar                               | `TableEmptyState`  |
| No matches           | `type='collection-empty'`, "No results found", `Button variant='outline' color='neutral'` "Reset filters"; not `type='no-results'` | `TableEmptyState`  |
| Rows selected        | The bar appears on its own                                                                                                         | `TableActionBar`   |
| Row open in a drawer | `activeRowId={openId}`; not a row `className`                                                                                      | `Table`            |
| Switch saving        | Keep the `Switch`, `Loader` in a reserved slot beside it                                                                           | `Switch`, `Loader` |
| Locked by scope      | Disabled control, `Lock` with a `Tooltip` naming the scope; never hide the row                                                     | `Tooltip`          |

## What your app owns

| You own                                         | The DS owns                                                   |
| ----------------------------------------------- | ------------------------------------------------------------- |
| `columns`, order, widths                        | Cell padding, borders, header, hover and selected backgrounds |
| Status-to-`color` mapping and labels            | `Badge` dot, size and colors                                  |
| Row menu items and handlers                     | Menu focus and keyboard                                       |
| Fetching, filtering, server sorting, pagination | Client sorting                                                |
| Which bulk actions exist                        | Bar placement, "Select all", "Clear"                          |
| Delete confirmation                             | Nothing; compose `Dialog`                                     |
| Scope marker                                    | Nothing; compose `Badge variant='dotted'` with `Lock`         |
| Metric cell (% over "x of y")                   | Nothing; compose `FormatNumber` and `Text size='xs'`          |
| Grouped or orderable tables                     | `getSubRows`, `renderGroupRow`, `onRowReorder`                |

## Related

- [Resource list page](https://wallarm.github.io/design-system/patterns/resource-list-page.md): the page shell.
- [Detail drawer](https://wallarm.github.io/design-system/patterns/detail-drawer.md): opens from a row.
- [Confirmation dialogs](https://wallarm.github.io/design-system/patterns/confirmation-dialogs.md): confirm deletes.
- [Feedback toasts](https://wallarm.github.io/design-system/patterns/feedback-toasts.md): report results.
- [Empty states](https://wallarm.github.io/design-system/patterns/empty-states.md), [Filtering](https://wallarm.github.io/design-system/patterns/filtering.md), [Spacing](https://wallarm.github.io/design-system/foundations/spacing.md).
