Skip to content

docs: add guide for getting and setting field values#2116

Open
Vitalini wants to merge 1 commit intoTanStack:mainfrom
Vitalini:docs/field-values-guide
Open

docs: add guide for getting and setting field values#2116
Vitalini wants to merge 1 commit intoTanStack:mainfrom
Vitalini:docs/field-values-guide

Conversation

@Vitalini
Copy link
Copy Markdown

@Vitalini Vitalini commented Apr 10, 2026

Fixes #478

Adds a new React guide page at docs/framework/react/guides/field-values.md covering the topics requested in the issue:

  • How to initialize a form with defaultValues
  • How to initialize with values from an API (with and without TanStack Query)
  • How to get a single field value or the entire form state (form.getFieldValue, form.state.values, field.state.value)
  • How to reactively subscribe to values (form.useStore, form.Subscribe)
  • How to set a single field (form.setFieldValue, updater functions, nested paths, field.setValue)
  • How to set multiple fields / reset the form (form.reset)
  • Whether setFieldValue triggers validation, and how to disable it (dontUpdateMeta, dontValidate) and trigger it manually (form.validateField)
  • Array helpers (pushFieldValue, insertFieldValue, removeFieldValue, etc.)
  • How to listen for value changes (field listeners prop, form.useStore)

Also adds the new guide to docs/config.json under the React Guides section.

Summary by CodeRabbit

  • Documentation
    • Added "Getting and Setting Field Values" guide to React framework documentation
    • New comprehensive guide covering field value initialization, retrieval, updates, and array field manipulation with TanStack Form

Adds a new React guide covering:
- Initializing forms with defaultValues (including async/API)
- Getting field values via form API, field API, and reactively
- Setting field values (single, batched, nested, arrays)
- Whether setFieldValue triggers validation (and opts to disable it)
- Listening for value changes

Fixes TanStack#478
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 16b543ea-35e6-4097-8ab1-0fc4aed63274

📥 Commits

Reviewing files that changed from the base of the PR and between 4276176 and 83e7d82.

📒 Files selected for processing (2)
  • docs/config.json
  • docs/framework/react/guides/field-values.md

📝 Walkthrough

Walkthrough

A new documentation guide is added to the React framework section covering initialization, retrieval, and updates of form field values in TanStack Form. The configuration file is updated to include the new guide in the navigation menu.

Changes

Cohort / File(s) Summary
Configuration Update
docs/config.json
Added new guide entry "Getting and Setting Field Values" to the React framework Guides section, positioned after "Basic Concepts".
Field Values Documentation
docs/framework/react/guides/field-values.md
New comprehensive guide documenting form initialization with defaultValues, value retrieval via form.getFieldValue(), form.state.values, and reactive subscriptions, value updates using form.setFieldValue() and field handlers, array field manipulation helpers, and change listeners through onChange callbacks and external subscriptions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A guide for getting values neat,
Setting fields complete,
Arrays dance with helpers true,
Forms now shine right on through! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'docs: add guide for getting and setting field values' accurately and concisely summarizes the main change of adding a new documentation guide.
Description check ✅ Passed The PR description comprehensively covers the changes, links to the relevant issue #478, and lists all major topics covered in the new guide.
Linked Issues check ✅ Passed All coding requirements from issue #478 are addressed: form initialization, API-based initialization, getting/setting single/multiple fields, validation behavior, retrieving values, and listening for changes.
Out of Scope Changes check ✅ Passed All changes are scoped to the PR objectives: adding the new guide document and updating the configuration to reference it, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] Guide page about getting and setting field values

2 participants