Skip to content

refactor(forms): relax [formField] input type from FieldTree to Field#66951

Merged
mattrbeck merged 3 commits intoangular:mainfrom
leonsenft:sf-field
Feb 11, 2026
Merged

refactor(forms): relax [formField] input type from FieldTree to Field#66951
mattrbeck merged 3 commits intoangular:mainfrom
leonsenft:sf-field

Conversation

@leonsenft
Copy link
Copy Markdown
Contributor

@leonsenft leonsenft commented Feb 7, 2026

FieldTree was an unnecessarily specific type for the [formField] input. It forced the directive to care about what kind of FieldTree was bound–specifically whether it was Reactive Forms compatible or not. This made it difficult to author forms system-agnostic components with passthrough [formField] inputs.

This change introduces Field, which represents the callable state of a FieldTree<TModel> (e.g. () => FieldState<TValue>), without any of its the structure or compatibility concerns.

Use of FieldTree for inputs is still appropriate when the component cares about the field's structure. For example:

@Component({
  template: `
    <street-address [formField]="address.street" />
    <zip-code [formField]="address.zip" />
  `,
})
class Address {
  readonly address = input.required<FieldTree<Address>>();
}

@leonsenft leonsenft added action: merge The PR is ready for merge by the caretaker and removed action: merge The PR is ready for merge by the caretaker labels Feb 7, 2026
@ngbot ngbot Bot modified the milestone: Backlog Feb 7, 2026
@leonsenft leonsenft added area: forms target: patch This PR is targeted for the next patch release labels Feb 7, 2026
@ngbot ngbot Bot added this to the Backlog milestone Feb 7, 2026
@leonsenft leonsenft added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Feb 7, 2026
…Field`

`FieldTree` was an unnecessarily specific type for the `[formField]`
input. It forced the directive to care about what _kind_ of `FieldTree`
was bound–specifically whether it was Reactive Forms compatible or not.
This made it difficult to author forms system-agnostic components with
passthrough `[formField]` inputs.

This change introduces `Field`, which represents the callable state of a
`FieldTree<TModel>` (e.g. `() => FieldState<TValue>`), without any of
its the structure or compatibility concerns.

Use of `FieldTree` for inputs is still appropriate when the component
cares about the field's structure. For example:

```ts
@component({
  template: `
    <street-address [formField]="address.street" />
    <zip-code [formField]="address.zip" />
  `,
})
class Address {
  readonly address = input.required<FieldTree<Address>>();
}
```
@leonsenft leonsenft marked this pull request as ready for review February 9, 2026 21:42
@leonsenft leonsenft requested review from kirjs and mmalerba and removed request for kirjs February 9, 2026 21:42
@pullapprove pullapprove Bot requested a review from crisbeto February 9, 2026 21:42
@leonsenft leonsenft requested a review from kirjs February 9, 2026 21:42
@pullapprove pullapprove Bot requested a review from devversion February 9, 2026 21:42
Comment thread packages/forms/signals/src/directive/form_field_directive.ts Outdated
@leonsenft leonsenft requested a review from mmalerba February 9, 2026 22:05
Copy link
Copy Markdown
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed-for: public-api

@leonsenft leonsenft added the action: global presubmit The PR is in need of a google3 global presubmit label Feb 10, 2026
@leonsenft
Copy link
Copy Markdown
Contributor Author

Passing TGP.

@leonsenft leonsenft added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Feb 11, 2026
@leonsenft
Copy link
Copy Markdown
Contributor Author

Note for caretaker: requires patch cl/867757980

@leonsenft leonsenft added the action: merge The PR is ready for merge by the caretaker label Feb 11, 2026
@leonsenft leonsenft removed the request for review from kirjs February 11, 2026 01:02
@AndrewKushnir AndrewKushnir removed the action: global presubmit The PR is in need of a google3 global presubmit label Feb 11, 2026
@mattrbeck mattrbeck merged commit 3606902 into angular:main Feb 11, 2026
24 of 26 checks passed
@mattrbeck
Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Mar 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: forms forms: signals merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note PullApprove: disable target: minor This PR is targeted for the next minor release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants