Skip to content
Skillpedia
Websites & UI (frontend)29k · #9843

table-state

What it does

This skill explains how to keep table settings, like the current page, in Vue refs and read them in the template. It is for Vue developers whose table and page must stay in step.

When to use it

  • ✓When a Vue template must show the current page or another table setting.
  • ✓When you need to connect a table's pagination to a ref or computed value.
  • ✓When a table value read in plain script code does not update after a change.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/TanStack/table/blob/main/packages/vue-table/skills/table-state/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“How do I make my Vue table's page number update on screen when I click next?”

5 new skills a week. 1 minute to read.

How it works

It shows how to keep the pagination setting in a ref, pass it to the table as computed state with a matching update callback and read it in the template.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Vue table state

Before starting, run intent load @tanstack/table-core#table-state for shared ownership, initialization, updates, and resets.

Read reactive state

Vue-backed atom reads track dependencies inside templates, computed, watch, or a render boundary. const page = table.atoms.pagination.get() outside tracking captures a snapshot. Keep reactive option inputs as refs, computed values, or getters; passing .value once breaks later synchronization.

table.Subscribe is deprecated. Read table APIs or atoms directly inside templates, render functions, computed getters, or watcher sources. Use a child component when reads need a separate component render boundary.

Control a slice

Keep features and columns stable. Preserve both the reactive value and its matching callback:

import { computed, ref } from 'vue'
import {
  rowPaginationFeature,
  tableFeatures,
  useTable,
  type PaginationState,
  type Updater,
} from '@tanstack/vue-table'

const features = tableFeatures({ rowPaginationFeature })
const columns = [{ accessorKey: 'name' }]
const data = ref([{ name: 'Ada' }])
const pagination = ref<PaginationState>({ pageIndex: 0, pageSize: 20 })
const state = computed(() => ({ pagination: pagination.value }))
const table = useTable({
  features,
  columns,
  data,
  state,
  onPaginationChange: (next: Updater<PaginationState>) => {
    pagination.value =
      typeof next === 'function' ? next(pagination.value) : next
  },
})
const pageSize = computed(() => table.atoms.pagination.get().pageSize)

Assign the resolved updater result to the ref. For shared atom ownership, use a stable @tanstack/vue-store atom in atoms.<slice> instead of mirroring the same slice in controlled refs.

For computed-state synchronization failures, updater mistakes, or render boundaries, read reactivity details. If this task changes processing features, run intent load @tanstack/table-core#table-features and read the relevant feature references.

API discovery

Inspect node_modules/@tanstack/vue-table/dist/useTable.d.ts and reactivity.d.ts; inspect the matching core feature declarations for the controlled slice.

FAQ

Why does a value read once in script not update?

Reads outside tracking capture a snapshot, and that snapshot does not refresh later.

Should I pass .value to the table?

No. The skill says passing a .value once breaks later synchronization, so keep reactive inputs as refs, computed values or getters.

Is table.Subscribe still used?

It is deprecated. The skill recommends reading table APIs or atoms directly in the template.

Details

Original description by the author

Read and control Table v9 state in vue. Use for tracked reads, subscriptions, controlled slices, and framework-specific reactive boundaries.

repo: TanStack/table

Popularity

GitHub stars
29k
Ranking position
#9843
License
MIT
Updated
10/21/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills