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

getting-started

できること

VueアプリでTanStack Tableを使い、データのテーブルを作成して表示する方法を説明します。テーブルの見た目と制御を自分で決めたいVue開発者向けです。

使う場面

  • ✓レコードを表示するVueコンポーネントを作っているとき。
  • ✓Vueテーブルのデータが時間とともに変わり、画面で更新される必要があるとき。
  • ✓Vueテーブルにクエリや仮想化の機能を追加したいとき。

スキルのリンク

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

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“ユーザー一覧をテーブルで表示するVueのページを作っています。設定方法を教えてください。”

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

仕組み

列を定義し、useTableでテーブルを作成し、テンプレート内でヘッダー、行、セルをループ表示する単一ファイルのコンポーネントを示します。

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

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

Vue Table setup and integration

Before starting, run intent load @tanstack/table-core#core for the shared headless model and stable-input rules.

Setup

<script setup lang="ts">
import { ref } from 'vue'
import { FlexRender, tableFeatures, useTable } from '@tanstack/vue-table'

type Person = { name: string; age: number }
const features = tableFeatures({})
const columns = [
  { accessorKey: 'name', header: 'Name' },
  { accessorKey: 'age', header: 'Age' },
]
const data = ref<Person[]>([{ name: 'Ada', age: 36 }])
const table = useTable({ features, columns, data })
</script>

<template>
  <table>
    <thead>
      <tr v-for="group in table.getHeaderGroups()" :key="group.id">
        <th v-for="header in group.headers" :key="header.id">
          <FlexRender v-if="!header.isPlaceholder" :header="header" />
        </th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="row in table.getRowModel().rows" :key="row.id">
        <td v-for="cell in row.getAllCells()" :key="cell.id">
          <FlexRender :cell="cell" />
        </td>
      </tr>
    </tbody>
  </table>
</template>

Essential constraints

Use useTable with a ref, computed value, or reactive getter for changing data. Passing data.value captures one array and loses later updates. Keep static features and columns stable; derive transformed arrays with computed.

Table owns models and state. The application owns markup, CSS, interactions, and accessibility. Core-only tables use row.getAllCells(); visibility-aware methods need columnVisibilityFeature. Optional state and APIs require their features. Put row-model slots after their prerequisite features in tableFeatures().

Load by task

  • For repeated features, defaults, typed contexts, or component registries, read reusable app hooks.
  • For Query-backed data, server pages, sorting, filtering, or request keys, read TanStack Query integration.
  • For virtual rows, columns, dynamic measurement, or infinite scrolling, read TanStack Virtual integration.
  • For controlled state, tracked reads, or render subscriptions, read table state.
  • For feature registration, missing feature APIs, or processing ownership, run intent load @tanstack/table-core#table-features and read only references needed by the task.
  • For v8 code, read the migration checklist.

API discovery

Inspect node_modules/@tanstack/vue-table/dist/index.d.ts, then the exported adapter declarations for the installed version. Inspect optional core APIs under node_modules/@tanstack/table-core/dist/features/.

よくある質問

変わるデータはどう渡せばよいですか?

refや算出値(computed)、リアクティブなゲッターを使うよう、このスキルは説明しています。一度だけ渡すと、後の更新が伝わらないからです。

先にコアガイドを読む必要がありますか?

はい。このスキルは、まず共通のコアガイドでヘッドレスの仕組みを読むよう求めています。

どのVueのバージョンが必要ですか?

Vue向けの移行ガイドでは、Table v9にはVue 3.2以上が必要だと説明しています。

詳細

作者による元の説明

Create and render Table v9 with the vue adapter. Route reusable createTableHook components, Query and Virtual integration, and framework setup; use table-state for reactive ownership.

repo: TanStack/table

人気

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

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

0

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

コメント

  • …

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

似ているスキル