svelte/compose-with-tanstack-form

Create editable Svelte 5+ datagrids by combining TanStack Table and TanStack Form with centralized row and field state.

28.3k|3.6k|Updated Oct 20, 2016
One-click install
npx skills add https://github.com/TanStack/table --skill svelte-compose-with-tanstack-form
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: svelte/compose-with-tanstack-form
Source: https://github.com/TanStack/table/tree/main/packages/svelte-table/skills/svelte/compose-with-tanstack-form
Command: npx skills add https://github.com/TanStack/table --skill svelte-compose-with-tanstack-form

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Editable tables often scatter state across cells, causing bugs, validation headaches, and confusing re-render behavior when users sort, filter, paginate, or virtualize rows.

Core Features & Use Cases

  • Form-owned editable state: The form owns per-row, per-field values and validation, while the table owns layout and row-model features.
  • Reusable field cell components: Create Svelte field components (like text, number, select) once and reuse them across columns via renderComponent and form.Field.
  • Robust table-to-form wiring: Drive @tanstack/svelte-table data directly from form.state.values.data, enabling add/remove/update flows and pairing with selection and virtualization.

Use this when you need an editable datagrid in Svelte 5+ where each cell edits structured form data, and you want consistent behavior across validation, pagination, and UI composition.

Quick Start

Ask an AI to show how to wire a createAppForm from @tanstack/svelte-form into @tanstack/svelte-table so each column cell renders a reusable form.Field-backed component using data[${rowIndex}].<fieldName>.

Frequently Asked Questions about svelte/compose-with-tanstack-form

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build editable Svelte tables with form validation?

To build editable Svelte tables with form validation, you compose TanStack Table with TanStack Form. The form centralizes row and field state, while the table controls layout, enabling validation and editable cells.

What is the best way to manage editable cell state in Svelte 5 datagrids?

Managing editable cell state in Svelte 5 datagrids is best done by centralizing values in TanStack Form. You drive the table data from form state, preventing bugs when sorting, filtering, paginating, or virtualizing rows.

How do I wire TanStack Form fields into TanStack Table columns?

You wire TanStack Form fields into TanStack Table columns using `renderComponent` to render reusable Svelte field components. These components bind to `form.Field` names formatted as `data[<rowIndex>].<fieldName>`.

Can I use TanStack Table virtualization with an editable form in Svelte?

Yes, you can use TanStack Table virtualization with an editable form in Svelte. The form owns the structured data state, feeding values to the table, which handles virtualization, row selection, filtering, and pagination.

Why does my editable Svelte table lose validation state when sorting or paginating?

Editable Svelte tables lose validation state when sorting or paginating if state is scattered across cells. Centralizing per-row and per-field validation in TanStack Form ensures consistent behavior during table operations.

Do I need to create a custom hook to connect TanStack Form and Svelte Table?

Yes, you need to create a reusable form hook using `createFormHook`. This hook connects TanStack Form to TanStack Table, allowing table data to be driven directly from `form.state.values.data`.