table-state
Qué hace
Esta habilidad explica cómo decidir si la tabla o tu propio código controla cada parte de su estado, como la paginación. Es para desarrolladores que necesitan que la tabla y su app coincidan en esos valores.
Cuándo usarla
- ✓Cuando quieres definir el estado inicial de una tabla, como el tamaño de página, sin tomar control de él.
- ✓Cuando necesitas controlar tú mismo una parte del estado y devolver sus cambios a la tabla.
- ✓Cuando un cambio de estado de la tabla no se conserva o no se reinicia como esperas.
Link de la skill
https://github.com/TanStack/table/blob/main/packages/table-core/skills/table-state/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“¿Cómo configuro mi tabla para que empiece con un tamaño de página de 25 y que siga pudiendo cambiar de página por sí misma?”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Muestra cómo definir valores iniciales para las partes que la tabla controla, cómo las partes controladas reciben un valor y un callback de cambio, y cómo reiniciar el estado con las funciones de la propia tabla.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Shared table state
Read core first for stable model inputs and feature-gated types. State repair in an existing table can start here without adapter setup guidance.
Start with internal ownership
Omit state, atoms, and on<Slice>Change for slices that Table should own. Use initialState only to customize their initial values.
import {
constructTable,
createColumnHelper,
rowPaginationFeature,
tableFeatures,
} from '@tanstack/table-core'
import { storeReactivityBindings } from '@tanstack/table-core/store-reactivity-bindings'
type Person = { id: string; name: string }
const features = tableFeatures({
coreReactivityFeature: storeReactivityBindings(),
rowPaginationFeature,
})
const helper = createColumnHelper<typeof features, Person>()
const columns = helper.columns([helper.accessor('name', {})])
const data: Person[] = [{ id: '1', name: 'Ada' }]
const table = constructTable({
features,
columns,
data,
initialState: { pagination: { pageIndex: 0, pageSize: 25 } },
})
table.setPageSize(50)
console.log(table.atoms.pagination.get().pageSize)
table.resetPagination()
console.log(table.atoms.pagination.get().pageSize)
This example demonstrates state only. A pagination row-model slot is needed when Table should also slice the data.
Choose one owner per slice
| Owner | Configuration | Update path |
|---|---|---|
| Table | Omit external values; optionally provide initialState.<slice> |
Feature setter or interaction handler |
| Framework state | Current state.<slice> plus matching on<Slice>Change |
Callback applies the updater and the adapter receives the fresh value |
| External atom | Stable writable atoms.<slice> |
Feature setters write directly to that atom; no matching callback is needed |
Prefer the smallest set of externally owned slices. Load the adapter's table-state skill before selecting framework state or an external atom package. Native signals, runes, refs, tracked properties, and Store atoms have different adapter wiring.
An updater can be a value or a function of the previous value. In a custom callback, use functionalUpdate(updater, previousValue) from @tanstack/table-core and write the result to the owner. Supplying only on<Slice>Change replaces the internal updater without returning a current controlled value; supplying only state.<slice> leaves no effective external update path.
If both atoms.<slice> and state.<slice> are supplied, the external atom wins. Choose one owner deliberately; writing an internal base atom cannot change a slice resolved from an external atom.
Distinguish state reads and writes
table.baseAtomscontains internal writable atoms created from resolved initial state. Prefer feature setters; direct base-atom writes bypass feature-specific behavior.table.atomscontains readonly resolved atoms per registered slice.table.atoms.pagination.get()reads whichever owner supplies pagination.table.storeis the readonly flat combination of resolved slices.table.store.statereads its current snapshot.table.state, where an adapter exposes it, is adapter-selected state. Its presence and subscription behavior are not shared core contracts.
A feature must be registered before its state appears in initialState, state, atoms, baseAtoms, or store. Let the concrete feature registry infer TableState; import a slice type such as PaginationState for an external owner instead of widening the complete state.
A direct atom/store read is not a portable framework subscription. Its tracking depends on the adapter and the scope of the read. For reactive UI, load intent load <package>#table-state using the installed adapter package, for example intent load @tanstack/react-table#table-state. Use that skill's supported read and subscription APIs.
Initialization and resets
initialState resolves at construction. Changing the supplied object later does not reset the table. Keep the registered features and external atom identities stable for the instance lifetime.
Feature resets such as `r
Preguntas frecuentes
¿Siempre tengo que controlar el estado yo mismo?
No. La habilidad indica omitir el estado de cualquier parte que la tabla deba controlar, y usar initialState solo para valores de inicio.
¿Una parte del estado puede tener dos dueños?
No. La habilidad indica elegir un solo dueño por parte.
¿Esta habilidad cubre las lecturas reactivas de cada framework?
No. Cubre las reglas compartidas de propiedad y remite a la habilidad de estado del adaptador para las lecturas reactivas.
Detalles
Descripción original del autor
Choose Table v9 state ownership, atoms, initialization, updates, and resets. Load for controlled slices or state coordination; use the adapter state skill for reactive reads.
repo: TanStack/table
Popularidad
- Estrellas en GitHub
- 29 mil
- Posición en el ranking
- #9838
- Licencia
- MIT
- Actualizada
- 21/10/2026
Comentarios
- …
Más skills de este repositorio
getting-started
29 milEnseña a tu agente a crear y mostrar una tabla de datos con TanStack Table en Alpine.js, incluyendo la configuración, los datos reactivos y el renderizado de filas.
table-state
29 milEnseña a tu agente a leer y controlar el estado de una tabla en Alpine.js, como la página actual, para que la pantalla se actualice cuando cambia ese estado.
devtools
29 milEnseña a tu agente a registrar tablas de Angular en el panel de TanStack Devtools, para que los desarrolladores puedan inspeccionar cada tabla mientras construyen la app.
getting-started
29 milEnseña a tu agente a crear una tabla de TanStack en Angular: configurar injectTable, renderizar la plantilla y actualizar las filas cuando cambian los datos.
Skills parecidas
angular-developer
280 milAyuda a tu agente con código de Angular y la estructura del proyecto. Útil para empezar proyectos, crear partes de código o mejorar el rendimiento y la accesibilidad.
frontend-a11y
280 milAyuda a tu agente a hacer que las interfaces web sean accesibles para todos. Asegura que sitios y apps funcionen bien con lectores de pantalla y navegación por teclado.
frontend-patterns
280 milHace que tu agente aplique patrones modernos en desarrollo frontend. Optimiza el rendimiento, gestiona el estado y sigue buenas prácticas en React y Next.js.