getting-started
できること
このスキルは、TanStack Tableを使って、Litのウェブコンポーネントの中に表を作る方法を示します。Litで再利用できるコンポーネントを作る開発者向けです。
使う場面
- ✓項目の一覧を表で表示するLitのウェブコンポーネントを作っているとき。
- ✓コンポーネントのデータが変わったときに、表を再描画する必要があるとき。
- ✓Litのアプリで同じ表の設定を何度も繰り返し、再利用できる版が欲しいとき。
スキルのリンク
https://github.com/TanStack/table/blob/main/packages/lit-table/skills/getting-started/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“人の一覧を表で表示するLitのウェブコンポーネントを作っています。どう設定すればよいですか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
表のコントローラーがコンポーネントにどう取り付けられるか、描画の間に表をどう作るか、そしてFlexRenderのヘルパーでヘッダーと行をどう表示するかを説明します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Load intent load @tanstack/table-core#core first for the headless model, stable inputs, and column inference.
Setup
import { LitElement, html } from 'lit'
import { customElement, state } from 'lit/decorators.js'
import { repeat } from 'lit/directives/repeat.js'
import {
FlexRender,
TableController,
createColumnHelper,
tableFeatures,
} from '@tanstack/lit-table'
type Person = { id: string; name: string }
const features = tableFeatures({})
const columnHelper = createColumnHelper<typeof features, Person>()
const columns = columnHelper.columns([
columnHelper.accessor('name', { header: 'Name' }),
])
@customElement('people-table')
export class PeopleTable extends LitElement {
@state() private people: Array<Person> = [{ id: '1', name: 'Ada' }]
private tableController = new TableController<typeof features, Person>(this)
protected render() {
const table = this.tableController.table({
features,
columns,
data: this.people,
getRowId: (row) => row.id,
})
return html`<table>
<thead>
${repeat(
table.getHeaderGroups(),
(group) => group.id,
(group) =>
html`<tr>
${repeat(
group.headers,
(header) => header.id,
(header) =>
html`<th>
${header.isPlaceholder ? null : FlexRender({ header })}
</th>`,
)}
</tr>`,
)}
</thead>
<tbody>
${repeat(
table.getRowModel().rows,
(row) => row.id,
(row) =>
html`<tr>
${repeat(
row.getAllCells(),
(cell) => cell.id,
(cell) => html`<td>${FlexRender({ cell })}</td>`,
)}
</tr>`,
)}
</tbody>
</table>`
}
}
Construction and rendering
Keep one TableController as a host field. V9 takes only the host in its constructor; pass current options to controller.table(...) during every render. Recreating the controller repeats lifecycle and subscription work.
Keep features, columns, and data stable across host updates. Use FlexRender({ cell }), FlexRender({ header }), or FlexRender({ footer }) in Lit templates. The application owns semantic markup, accessibility, widths, and sticky positioning.
The controller selects all registered state by default. Narrow selected state only when host update cost requires it; use table-state for selectors and template subscriptions.
Read for the task
- When adding or configuring optional features, load
intent load @tanstack/table-core#table-featuresand read only references for the requested behavior. - For state ownership or reactive reads, read table-state.
- When tables share features, defaults, or reusable UI, read create-table-hook.
- When virtualizing rows or columns, read with-tanstack-virtual.
- When upgrading v8 code, read migrate-v8-to-v9.
API discovery
Inspect node_modules/@tanstack/lit-table/dist/index.d.ts, then TableController.d.ts, flexRender.d.ts, or the relevant exported declaration. Core feature APIs are in node_modules/@tanstack/table-core/dist/features/.
よくある質問
表のコントローラーは何をしますか?
コンポーネントのために表を作り、表が使っている状態が変わったときにコンポーネントの更新を求めます。
Litのテンプレートの仕組みを知っている必要がありますか?
基本的なLitの知識があると役立ちます。例ではLitのhtmlテンプレートとrepeatのディレクティブを使うからです。
Litだけが対象ですか?
はい、TanStack Table v9のLit版を扱います。
詳細
作者による元の説明
Create and render Table v9 with the lit adapter. Route reusable createTableHook components, Virtual integration, and framework setup; use table-state for reactive ownership.
repo: TanStack/table
人気
- GitHubのスター
- 29k
- ランキング
- #9813
- ライセンス
- MIT
- 更新日
- 2026/10/21
コメント
- …
このリポジトリの他のスキル
getting-started
29kエージェントが、Alpine.jsでTanStack Tableを使ってデータテーブルを作り、表示する方法を教えます。セットアップ、リアクティブなデータ、行の描画を扱います。
table-state
29kエージェントが、Alpine.jsで表の状態(現在のページなど)を読み取り、制御する方法を教えます。その状態が変わると、画面が更新されます。
devtools
29kエージェントが、Angularの表をTanStack Devtoolsのパネルに登録する方法を教えます。開発者はアプリを作りながら、各表を調べられます。
getting-started
29kエージェントが、AngularでTanStack Tableの表を作り、表示する方法を教えます。injectTableの設定、テンプレートの描画、行データの更新を扱います。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。