data-tables

Selects and configures TanStack React table variants by data shape and feature needs.

10|3|Updated Oct 23, 2023
One-click install
npx skills add https://github.com/Layer-Fi/layer-react --skill data-tables-layer-fi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: data-tables
Source: https://github.com/Layer-Fi/layer-react/tree/main/src/components/blocks/Table
Command: npx skills add https://github.com/Layer-Fi/layer-react --skill data-tables-layer-fi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/react-table, @tanstack/react-virtual, react-aria-components, react-i18next, classnames, lucide-react.

What problem does it solve? Choosing the wrong table variant or misconfiguring columns, expansion, or selection leads to broken layouts and rework. This Skill maps your data shape to the correct table variant and documents every configuration area so tables render correctly the first time. ## Core Features & Use Cases - Variant selection by data shape: SimpleDataTable for short flat arrays, PaginatedDataTable for paged lists, VirtualizedDataTable for long scrollable lists, and ExpandableDataTable for tree data with nested rows. - Configuration guidance: Covers column configs, CSS grid-based column widths, alignment, pinning, grouped headers, row selection with injected checkbox columns, clickable rows, inline expanded detail panels, and loading/error/empty states. - Use Case: When building a chart-of-accounts screen with nested account rows, use ExpandableDataTable with getSubRows and a stable getRowId, plus a stylesheet defining grid-template-columns keyed on the componentName classes. ## Quick Start Ask the AI to build a paginated customer table with row selection and pinned columns using the Table blocks, following the variant and columnConfig conventions in this Skill.

Frequently Asked Questions about data-tables

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between SimpleDataTable, PaginatedDataTable, and VirtualizedDataTable?▼

Pick by data shape and UX: SimpleDataTable renders a short flat array at once, PaginatedDataTable chunks a flat array behind a pager, and VirtualizedDataTable keeps one continuous scroll mounting only visible rows. All three take flat arrays, not trees.

How do I render nested or expandable rows in a TanStack react-table?▼

Use ExpandableDataTable with getSubRows and a stable getRowId for true tree data where rows indent by depth. For an inline detail panel beneath a flat row, use expandedRowProps on any variant instead — that is not a tree.

Why does my data table render with broken column widths?▼

Tables lay out rows as CSS grid and nothing in the column config sets grid-template-columns. You must provide a stylesheet keyed on the componentName classes, such as .Layer__UI__Table__YourName, with one grid track per column.

How do I add a checkbox selection column to a data table?▼

Pass selectionProps with rowSelection state, onRowSelectionChange, and a translated selectAllAriaLabel — the checkbox column is injected automatically, so do not add one to your column config. Use enableRowSelection as a predicate to restrict which rows are selectable.

Should I handle loading and empty states around the table myself?▼

No. Pass the query's isLoading and isError flags straight through plus slots.EmptyState and slots.ErrorState; every variant keeps its header and renders a skeleton, error, or empty fallback row inside the table itself.