-
-
Notifications
You must be signed in to change notification settings - Fork 607
Add preact integration for tanstack form #2043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c104cd7
13142b3
f854bfa
ccc4c6f
5ec0c52
2e80b40
a8dc0ee
22decc1
aa83641
203d01d
faa42d9
b8189a9
e739893
0e39f14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,15 +10,17 @@ We support this through our `onDynamic` validation function. | |
|
|
||
| ```angular-ts | ||
| import { Component } from '@angular/core' | ||
| import { TanStackField, injectForm, revalidateLogic } from '@tanstack/angular-form' | ||
| import { | ||
| TanStackField, | ||
| injectForm, | ||
| revalidateLogic, | ||
| } from '@tanstack/angular-form' | ||
|
|
||
| @Component({ | ||
| selector: 'app-root', | ||
| standalone: true, | ||
| imports: [TanStackField], | ||
| template: ` | ||
| <!-- Your form template here --> | ||
| `, | ||
| template: ` <!-- Your form template here --> `, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation regression: Template examples replaced with non-functional placeholders. Replacing actual template code with placeholder comments like Additionally, this is inconsistent—some examples (e.g., lines 101, 138-143, 189-213) retain actual template code while these are replaced with placeholders. Restore the original template examples to maintain documentation quality. Also applies to: 70-70, 254-254, 294-294 🤖 Prompt for AI Agents |
||
| }) | ||
| export class AppComponent { | ||
| form = injectForm({ | ||
|
|
@@ -65,9 +67,7 @@ You can, for example, use the following to revalidate on blur after the first su | |
| selector: 'app-root', | ||
| standalone: true, | ||
| imports: [TanStackField], | ||
| template: ` | ||
| <!-- Your form template here --> | ||
| `, | ||
| template: ` <!-- Your form template here --> `, | ||
| }) | ||
| export class AppComponent { | ||
| form = injectForm({ | ||
|
|
@@ -87,15 +87,18 @@ Just as you might access errors from an `onChange` or `onBlur` validation, you c | |
|
|
||
| ```angular-ts | ||
| import { Component } from '@angular/core' | ||
| import { TanStackField, injectForm, injectStore, revalidateLogic } from '@tanstack/angular-form' | ||
| import { | ||
| TanStackField, | ||
| injectForm, | ||
| injectStore, | ||
| revalidateLogic, | ||
| } from '@tanstack/angular-form' | ||
|
|
||
| @Component({ | ||
| selector: 'app-root', | ||
| standalone: true, | ||
| imports: [TanStackField], | ||
| template: ` | ||
| <p>{{ formErrorMap().onDynamic?.firstName }}</p> | ||
| `, | ||
| template: ` <p>{{ formErrorMap().onDynamic?.firstName }}</p> `, | ||
| }) | ||
| export class AppComponent { | ||
| form = injectForm({ | ||
|
|
@@ -121,7 +124,12 @@ You can use `onDynamic` validation alongside other validation logic, such as `on | |
|
|
||
| ```angular-ts | ||
| import { Component } from '@angular/core' | ||
| import { TanStackField, injectForm, injectStore, revalidateLogic } from '@tanstack/angular-form' | ||
| import { | ||
| TanStackField, | ||
| injectForm, | ||
| injectStore, | ||
| revalidateLogic, | ||
| } from '@tanstack/angular-form' | ||
|
|
||
| @Component({ | ||
| selector: 'app-root', | ||
|
|
@@ -167,7 +175,11 @@ You can also use `onDynamic` validation with fields, just like you would with ot | |
|
|
||
| ```angular-ts | ||
| import { Component } from '@angular/core' | ||
| import { TanStackField, injectForm, revalidateLogic } from '@tanstack/angular-form' | ||
| import { | ||
| TanStackField, | ||
| injectForm, | ||
| revalidateLogic, | ||
| } from '@tanstack/angular-form' | ||
| import type { FieldValidateFn } from '@tanstack/angular-form' | ||
|
|
||
| @Component({ | ||
|
|
@@ -180,7 +192,7 @@ import type { FieldValidateFn } from '@tanstack/angular-form' | |
| [tanstackField]="form" | ||
| name="age" | ||
| [validators]="{ | ||
| onDynamic: ageValidator | ||
| onDynamic: ageValidator, | ||
| }" | ||
| #age="field" | ||
| > | ||
|
|
@@ -229,15 +241,17 @@ Async validation can also be used with `onDynamic` just like with other validati | |
|
|
||
| ```angular-ts | ||
| import { Component } from '@angular/core' | ||
| import { TanStackField, injectForm, revalidateLogic } from '@tanstack/angular-form' | ||
| import { | ||
| TanStackField, | ||
| injectForm, | ||
| revalidateLogic, | ||
| } from '@tanstack/angular-form' | ||
|
|
||
| @Component({ | ||
| selector: 'app-root', | ||
| standalone: true, | ||
| imports: [TanStackField], | ||
| template: ` | ||
| <!-- Your form template here --> | ||
| `, | ||
| template: ` <!-- Your form template here --> `, | ||
| }) | ||
| export class AppComponent { | ||
| form = injectForm({ | ||
|
|
@@ -266,16 +280,18 @@ You can also use standard schema validation libraries like Valibot or Zod with ` | |
|
|
||
| ```angular-ts | ||
| import { Component } from '@angular/core' | ||
| import { TanStackField, injectForm, revalidateLogic } from '@tanstack/angular-form' | ||
| import { | ||
| TanStackField, | ||
| injectForm, | ||
| revalidateLogic, | ||
| } from '@tanstack/angular-form' | ||
| import { z } from 'zod' | ||
|
|
||
| @Component({ | ||
| selector: 'app-root', | ||
| standalone: true, | ||
| imports: [TanStackField], | ||
| template: ` | ||
| <!-- Your form template here --> | ||
| `, | ||
| template: ` <!-- Your form template here --> `, | ||
| }) | ||
| export class AppComponent { | ||
| schema = z.object({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These Angular documentation formatting changes are unrelated to the PR objective.
This PR is about adding Preact integration, but these changes modify Angular documentation formatting. Consider moving unrelated documentation formatting updates to a separate PR to maintain clear change scope and simplify review.
Also applies to: 90-95, 127-132, 178-182, 244-248, 283-287
🤖 Prompt for AI Agents