ChronicStone/nuxt-ui-tools / skills/consumer/table
nuxt-ui-tools-table
VerifiedUse 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.6 KB |
| references/actions.md | markdown | 7.7 KB |
| references/columns.md | markdown | 4.1 KB |
| references/context.md | markdown | 1.3 KB |
| references/data-modes.md | markdown | 2.9 KB |
| references/filters.md | markdown | 17.7 KB |
| references/getting-started.md | markdown | 1.4 KB |
| references/groups.md | markdown | 2.1 KB |
| references/layouts.md | markdown | 6.7 KB |
| references/overview.md | markdown | 1.2 KB |
| references/pagination.md | markdown | 2.5 KB |
| references/patterns.md | markdown | 989 B |
| references/schema-surface.md | markdown | 1.3 KB |
| references/selection.md | markdown | 3.3 KB |
| references/slots.md | markdown | 11.0 KB |
| references/sorting.md | markdown | 480 B |
| references/tree.md | markdown | 3.9 KB |
| references/url-state.md | markdown | 1.6 KB |
references/selection.md
View on GitHub# Table Selection
Selection is configured through `selection` and related table behavior.
## Example
```ts
selection: {
mode: 'auto',
scope: 'all',
}
```
## What `mode` Means
- `false`: disable selection
- `true`: always enable selection
- `'auto'`: enable selection when the current schema and actions make it useful
## What `scope` Means
`scope` controls what the header "select all" checkbox targets in client tables:
- `'page'`: only the current paginated page
- `'all'`: all filtered rows across the current client dataset
Example:
```ts
selection: {
mode: 'auto',
scope: 'all',
}
```
Important rule:
- `scope` is only meaningful for client tables
- remote tables stay page-scoped
- if `scope` is omitted, client tables default to `'all'`
## Typical Usage With Bulk Actions
```ts
const schema = defineTableSchema({
tableKey: 'employees',
rowKey: 'id',
source: tableSource({
mode: 'client',
query: () => ({
queryKey: ['employees'],
queryFn: async () => rows,
}),
}),
selection: {
mode: 'auto',
scope: 'all',
},
actions: [
{
key: 'archive',
label: 'Archive selected',
requiresSelection: true,
action: async ({ selectedRows }) => {
await archiveEmployees(selectedRows.map((row) => row.id))
},
},
],
table: {
columns: (column) => [column.field('fullName', { label: 'Employee' })],
},
})
```
Selection is most useful when your table supports:
- row selection
- bulk workflows
- action toolbars
With the default `'auto'` mode, the selection column is omitted when the schema has
no bulk actions. Toolbar and row actions do not imply row selection. Set
`selection.mode` to `true` when an application needs selection for a custom workflow
that is not represented by bulk actions.
## Selection In The Grid
When selection is on, every grid card carries a checkbox in its top-right corner (a 44px touch target) and a « select all » row sits above the cards. The checkbox belongs to the library's card shell, so it appears around any `renderItem`, including a custom card, and takes no room in the card's layout. They edit the same selection as the table, so the selection bar and bulk actions appear the same way. Cards without selection stay unchanged. Style the select-all row with `ui.grid.ui.selectAll`; a selected card carries `data-selected="true"`.
To place the checkbox yourself, turn the corner one off and use `selection` from the `renderItem` params:
```ts
grid: {
selectControl: false,
renderItem: ({ row, selection }) => h(ContactCard, { row }, () => selection.renderControl()),
},
```
`selection` holds `enabled`, `selected`, `toggle()` and `renderControl()`, which draws the library's checkbox named after the row (it renders nothing when selection is off).
## Accessible Names
Row controls read the record they act on. Set `rowLabel` on the schema so a screen reader hears "Select Fleury SCS" and "Actions for Fleury SCS" instead of a bare checkbox:
```ts
rowLabel: (row) => row.name,
```
Return `null`, `undefined`, or a blank string for a record that has no name, and the controls fall back to its position on the page ("Select row 3"). The names follow the locale. The header checkbox is named "Select all rows" and the mobile actions sheet takes the record's name as its title.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |