lit/lit-table-controller

Integrate TanStack Table with LitElement via a ReactiveController.

28.3k|3.6k|Updated Oct 20, 2016
One-click install
npx skills add https://github.com/TanStack/table --skill lit-lit-table-controller
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lit/lit-table-controller
Source: https://github.com/TanStack/table/tree/main/packages/lit-table/skills/lit/lit-table-controller
Command: npx skills add https://github.com/TanStack/table --skill lit-lit-table-controller

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves the challenge of integrating TanStack Table’s stateful core with LitElement’s rendering lifecycle so the UI stays in sync with table state and option changes.

Core Features & Use Cases

  • ReactiveController lifecycle wiring: Uses Lit’s ReactiveController pattern to construct and manage a single TanStack Table instance per host.
  • Store-driven re-rendering: Subscribes to both table.store (state) and table.optionsStore (options) and triggers host.requestUpdate() when they change.
  • Correct multi-table and multi-host usage: Ensures each LitElement host gets its own controller instance and cleanly tears down subscriptions on hostDisconnected.

Quick Start

Use the lit-table-controller skill to implement a LitElement that creates one TableController per host and calls .table(options, selector?) during render() so the table re-renders as TanStack Table state changes.

Frequently Asked Questions about lit/lit-table-controller

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

FAQPage Schema
How do I integrate TanStack Table with LitElement for state management?

You can integrate TanStack Table with LitElement by hosting the table instance inside a Lit ReactiveController, which bridges store updates to trigger host re-renders automatically. This ensures your datagrid UI stays in sync with table state changes.

Can I use TanStack Table state management in a Lit web component datagrid?

Yes, TanStack Table state management works in a Lit web component by subscribing the ReactiveController to both table.store and table.optionsStore, then calling host.requestUpdate() when state changes. This maintains full control of markup and styling.

How does the Lit ReactiveController keep TanStack Table UI rendering in sync?

The ReactiveController keeps UI rendering in sync by subscribing to table.store and table.optionsStore, triggering host.requestUpdate() whenever either store changes. This bridges TanStack Table's stateful core with LitElement's rendering lifecycle.

Do I need a separate controller instance for multiple TanStack Tables in one LitElement?

Each LitElement host gets its own controller instance to ensure correct multi-table and multi-host usage. The controller constructs once on the first .table() call and cleanly tears down subscriptions during hostDisconnected.

What are the limitations of hosting TanStack Table inside Lit?

Hosting TanStack Table inside Lit requires manual subscription management to table.store and table.optionsStore to trigger re-renders. You must ensure proper teardown on hostDisconnected to avoid memory leaks when managing multiple table instances.

What's the best way to handle sortable and filterable datagrid state in Lit?

The best way to handle sortable and filterable datagrid state in Lit is using a ReactiveController to host a single TanStack Table instance. It merges options via table.setOptions and subscribes to store changes for reactive UI updates while maintaining full markup control.