tanstack-vue-form-skilld
БесплатноБез исполняемых скриптовНе проверенUse when writing, reviewing, or debugging code that imports @tanstack/vue-form (TanStack Form for Vue). Covers the 1.33.x API, including useForm, form.Field…
от skilld-dev★ 188 звёзд на GitHubОб этом скилле
@tanstack/vue-form 1.33.5
Headless, type-safe form state for Vue 3. The package re-exports all of @tanstack/form-core and adds Vue components and hooks (src/index.ts:1-5).
Environment
- Version studied:
@tanstack/[email protected], bundling@tanstack/[email protected]and@tanstack/vue-store@^0.11.0(package.json:39-42). - Peer dependency:
vue ^3.4.0(package.json:48-50). TypeScript 5.4 through 5.9 are in the test matrix (package.json:54-60). - Import from the package root only. The sole subpath export is
./package.json(package.json:21-33). Dual ESM/CJS,sideEffects: false. - Official docs: https://tanstack.com/form/latest/docs/framework/vue/overview
Minimal form
<script setup lang="ts">
import { useForm } from '@tanstack/vue-form'
const form = useForm({
defaultValues: {
fullName: '',
},
onSubmit: async ({ value }) => {
console.log(value)
},
})
</script>
<template>
<form @submit.prevent.stop="form.handleSubmit">
<form.Field name="fullName">
<template v-slot="{ field }">
<input
:name="field.name"
:value="field.state.value"
@blur="field.handleBlur"
@input="(e) => field.handleChange((e.target as HTMLInputElement).value)"
/>
</template>
</form.Field>
<button type="submit">Submit</button>
</form>
</template>
Source: official quick start, https://tanstack.com/form/latest/docs/framework/vue/quick-start
Field binding rules
- Fields are created with the
form.Fieldcomponent. Thenameprop must be a deep key ofdefaultValues, for example'details.email'or`people[${i}].name`. - The scoped slot receives
{ field, state }(src/useField.tsx:543-547).fieldis aFieldApi,statemirrorsfield.state. - Inputs are controlled: bind
:value="field.state.value", push updates throughfield.handleChange, and wire@blur="field.handleBlur". - For number inputs, use
(e.target as HTMLInputElement).valueAsNumber. - Do not write
v-modelon the slot input; state flows throughhandleChange. form.Fieldmerges its props with fallthrough attrs before creating the field (src/useField.tsx:541), so validators and listeners can be passed as props or attrs.
Reactivity
- In
<script setup>, useform.useSelector((state) => state.values.firstName). It returns aReadonly<Ref<T>>(src/useForm.tsx:155-189). form.useStoreis deprecated; it is the same function asuseSelector. Preferform.useSelector(src/useForm.tsx:190-227, 336-337).- In the template, use
<form.Subscribe>with an optionalselectorprop. Withoutselector, the slot receives the whole form state (src/useForm.tsx:338-349). - Do not call the
useFieldhook directly for reactivity. It is designed for use insideform.Field; useform.useSelectorinstead (official basic-concepts note, https://tanstack.com/form/latest/docs/framework/vue/guides/basic-concepts). useSelectoranduseStoreare re-exported from@tanstack/vue-storefor raw store access (src/index.ts:2).
Details: references/reactivity.md
Validation essentials
- Pass validators via the
validatorsprop onform.Field, orvalidatorsinuseFormoptions. Hooks:onMount,onChange,onBlur,onSubmit,onDynamic, each with anAsyncvariant. - A validator returns
undefinedwhen valid, or an error of any type (usually a string). Errors land infield.state.meta.errorsandfield.state.meta.errorMap. - Standard Schema libraries work directly as validators: Zod v3.24.0 or higher, Valibot v1.0.0 or higher, ArkType v2.1.20 or higher, Yup v1.7.0 or higher (official basic-concepts guide).
- Debounce async validators with the
async-debounce-msprop or per-validatoronChangeAsyncDebounceMs. onDynamicvalidators only run whenvalidationLogic: revalidateLogic()is set inuseFormoptions.
<form.Field
name="age"
:validators="{
onChange: z.number().gte(13, 'You must be 13 to make an account'),
}"
>
Details: references/validation.md
Array fields
- Give the wrapping field
mode="array". In array mode the component tracksstate.meta._arrayVersioninstead of the value, so child edits do not re-render the whole list (src/useField.tsx:258-267, src/types.ts:12-15). - Render sub-fields with
v-foroverfield.state.valueand deep names such as`people[${i}].name`. - Mutate through the array methods:
pushValue,removeValue,swapValues,moveValue,insertValue,replaceValue,clearValues.
Details: references/array-fields.md
Form groups
<form.FormGroup name="step1" v-slot="{ group }">builds a sub-form for one key of the form data. The slot receives{ group, state }(src/useFormGroup.tsx:525-529).group.handleSubmit()submits and validates only the group;form.handleSubmit()submits the whole form.- Group validators can return
{ group, fields }, where
Установить tanstack-vue-form-skilld в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл tanstack-vue-form-skilld?
Use when writing, reviewing, or debugging code that imports @tanstack/vue-form (TanStack Form for Vue). Covers the 1.33.x API, including useForm, form.Field, form.FormGroup, form.Subscribe, form.useSelector, validators with Standard Schema, onDynamic with revalidateLogic, and array fields with mode="array". Result, forms built on current, non-deprecated Vue APIs with correct reactivity.
Как установить скилл tanstack-vue-form-skilld?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tanstack-vue-form-skilld запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic