本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)29k · #9805

getting-started

できること

このスキルは、Alpine.jsで作られたウェブページに、TanStack Tableライブラリを使ってデータの表を作って表示する方法を示します。自分でスタイルを決めるヘッドレスの表を求めるウェブ開発者向けです。

使う場面

  • ✓記録の構造化された表が必要な、Alpine.jsのページを作っているとき。
  • ✓表のデータが時間とともに変わり、画面の表も更新される必要があるとき。
  • ✓FlexRenderのヘルパーで、表のヘッダーとセルを描画したいとき。

スキルのリンク

https://github.com/TanStack/table/blob/main/packages/alpine-table/skills/getting-started/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/TanStack/table/blob/main/packages/alpine-table/skills/getting-started/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Alpine.jsのページで、顧客の一覧を表にしています。TanStack Tableでどう設定すればよいでしょうか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

列の定義とデータから表を作るコードの例を示します。そのうえで、Alpineのテンプレートのループを使って、ヘッダーと行をページに描画する方法を示します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Load intent load @tanstack/table-core#core first for the headless model, stable inputs, and column inference.

Setup

import Alpine from 'alpinejs'
import {
  FlexRender,
  createTable,
  tableFeatures,
  type ColumnDef,
} from '@tanstack/alpine-table'

type Person = { id: string; name: string }
const features = tableFeatures({})
const columns: Array<ColumnDef<typeof features, Person>> = [
  { accessorKey: 'name', header: 'Name' },
]

Alpine.data('peopleTable', () => {
  const local = Alpine.reactive({
    data: [{ id: '1', name: 'Ada' }] as Array<Person>,
  })
  const table = createTable({
    features,
    columns,
    get data() {
      return local.data
    },
    getRowId: (row) => row.id,
  })

  return { table, FlexRender }
})

window.Alpine = Alpine
Alpine.start()

Render real table structure with x-for; use x-html="FlexRender({ header })" or x-html="FlexRender({ cell })" only for renderer output.

Construction and rendering

Wrap changing data in Alpine.reactive and expose it with get data(). The adapter tracks option getters; data: local.data captures a snapshot and does not follow later array replacements. Keep static columns and features outside getters.

The returned table is a reactive proxy. Read Table APIs directly in x-text, x-for, x-if, or bound attributes; no Subscribe component is needed.

Build table structure and interactive controls as real Alpine markup. Use x-html="FlexRender({ header })" or x-html="FlexRender({ cell })" for renderer output. Alpine does not initialize directives inside x-html strings; use templates or Alpine.bind bundles for buttons and inputs.

Read for the task

  • When adding or configuring optional features, load intent load @tanstack/table-core#table-features and 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.

API discovery

Inspect node_modules/@tanstack/alpine-table/dist/index.d.ts, createTable.d.ts, and reactivity.d.ts. Core feature APIs are in node_modules/@tanstack/table-core/dist/features/.

よくある質問

TanStack Tableを既に詳しく知っている必要がありますか?

深くは必要ありません。スキルは背景の情報として中核のガイドを示し、そのあとAlpine特有の設定を扱います。

変わるデータと表を同期させるにはどうしますか?

データをAlpineのリアクティブなストアに入れ、ゲッターを通じて公開することを勧めています。

Alpine.js専用ですか?

はい、Table v9のAlpine版を扱います。他のフレームワークにはそれぞれの別のガイドがあります。

詳細

作者による元の説明

Create and render Table v9 with the alpine adapter. Route reusable createTableHook defaults, and framework setup; use table-state for reactive ownership.

repo: TanStack/table

人気

GitHubのスター
29k
ランキング
#9805
ライセンス
MIT
更新日
2026/10/21

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル