Skip to content

ChronicStone/nuxt-ui-tools / skills/consumer/table

nuxt-ui-tools-table

Verified

Use this skill when building or debugging table usage with nuxt-ui-tools as a package consumer. Covers defineTableSchema, useTable, DataList, granular composition, columns, filters, sorting, offset or cursor loading, layouts, summary rows on phones, first-use empty states, actions, selection, accessible row names, context, and URL state with concrete examples.

FileKindSize
SKILL.mdskill md3.6 KB
references/actions.mdmarkdown7.7 KB
references/columns.mdmarkdown4.1 KB
references/context.mdmarkdown1.3 KB
references/data-modes.mdmarkdown2.9 KB
references/filters.mdmarkdown17.7 KB
references/getting-started.mdmarkdown1.4 KB
references/groups.mdmarkdown2.1 KB
references/layouts.mdmarkdown6.7 KB
references/overview.mdmarkdown1.2 KB
references/pagination.mdmarkdown2.5 KB
references/patterns.mdmarkdown989 B
references/schema-surface.mdmarkdown1.3 KB
references/selection.mdmarkdown3.3 KB
references/slots.mdmarkdown11.0 KB
references/sorting.mdmarkdown480 B
references/tree.mdmarkdown3.9 KB
references/url-state.mdmarkdown1.6 KB

references/columns.md

View on GitHub
# Table Columns

Current column kinds:

- field
- composite
- display

Use the column builder in `table.columns`:

```ts
columns: (column) => [
  column.field('fullName', {
    label: 'Employee',
    minWidth: 260,
  }),
  column.composite('skillsSummary', {
    label: 'Skills',
    render: ({ row }) => row.skills.join(', '),
  }),
]
```

## Field Columns

```ts
column.field('salary', {
  label: 'Salary',
  align: 'right',
  render: ({ value }) => formatCurrency(Number(value ?? 0)),
})
```

## Composite Columns

```ts
column.composite('skillsSummary', {
  label: 'Skills',
  sortableKey: 'fullName',
  render: ({ row }) => row.skills.join(', '),
})
```

## Display Columns

```ts
column.display('statusBadge', {
  label: 'Status',
  render: ({ row }) => (row.isActive ? 'Online' : 'Paused'),
})
```

## Common Options

Column options currently include things like:

- `label`
- `icon`
- `width`
- `minWidth`
- `maxWidth`
- `sortable`
- `pinned`
- `align`
- `labelAlign`
- `ellipsis`
- `resizable`
- `condition`
- `enabled`
- `required`
- `visible`
- `skeleton`
- `summary`

## Widths

`width` is the column's size. The header-label floor only applies to columns without a `width`, so an authored narrow numeric column stays narrow and its label truncates if needed. When all columns fit, the spare space goes to a trailing filler column: columns keep their widths, row hover and borders still span the full table, and end-pinned columns stay at the right edge.

## Loading Skeletons

`skeleton` shapes the placeholder a column draws during the first load. Pass a kind, or a config to mirror the rendered cell:

```ts
column.field('name', {
  skeleton: { kind: 'avatar', lines: 2, width: [0.5, 0.85] },
})
column.field('account.name', { skeleton: { kind: 'icon', width: [0.5, 0.85] } })
column.field('status', { skeleton: { kind: 'dot', width: [0.45, 0.6] } })
column.field('roles', { skeleton: { kind: 'badge', count: 2 } })
column.field('total', { align: 'right', skeleton: { kind: 'number', lines: 2 } })
```

Kinds: `text`, `avatar` (28px leading avatar), `icon` (18px leading icon or logo, for link cells), `dot`, `check`, `badge`, `number`, `progress`, and `none`. `lines: 2` adds a caption line, `avatar: 'circle'` rounds avatars and icons, `width` is a fixed share or a `[min, max]` range varied per row, and `count` sets the number of badges. Right-aligned columns default to `number`.

## Summary Rows

Each column can render its own footer cells. The `summary` array places one cell in each footer row; a row is shown when at least one visible column's cell passes its optional `condition`. The render context includes the typed raw query `data`, current page `rows`, `allRows` and `filteredRows` for client sources, `selectedRows`, the current `request`, `context`, and `pageContext`.

```ts
table: {
  columns: (column) => [
    column.field('invoiceNumber', {
      summary: [
        { render: () => 'Filtered total' },
        { condition: ({ selectedRows }) => selectedRows.length > 0, render: () => 'Selected' },
      ],
    }),
    column.field('total', {
      align: 'right',
      summary: [
        { render: ({ data }) => data?.summary?.total ?? '—' },
        {
          condition: ({ selectedRows }) => selectedRows.length > 0,
          render: ({ selectedRows }) => selectedRows.reduce((total, row) => total + row.total, 0),
        },
      ],
    }),
  ],
}
```

The source query determines whether `data.summary` exists and what it means. For a `drizzle-resource` query with `summary: true`, it aggregates every row matching the scope, filters, and search, independently of pagination. The table does not start an extra request for a summary cell. Footer cells retain the column's alignment and pinned position.

The earlier `summary: 'sum'` and `table.summaries` contracts remain available for existing tables. Use the array form when cells need typed query data or multiple rows.

## Wide Tables

Tables with more than 12 unpinned visible columns virtualize columns as well as rows: only the columns in view and a small overscan are mounted, and spacer cells keep the header, body, and summary row aligned. Pinned columns always render. Query a cell after scrolling its column into view.
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall