Skip to content

Allow permanent hidden fields similar to disabled and readonly in signal forms #68278

@Ash-Codez

Description

@Ash-Codez

Which @angular/* package(s) are relevant/related to the feature request?

forms

Description

https://angular.dev/guide/forms/signals/form-logic#configuring-hidden-state-on-fields

The disabled and readonly both support either permanent or conditional

disabled(SchemaPath) or disabled(SchemaPath, (FieldContext) => boolean)
readonly(SchemaPath) or readonly(SchemaPath, (FieldContext) => boolean)

but hidden currently only supports conditional

hidden(SchemaPath, (FieldContext) => boolean)

There are cases similar to disabled and readonly where one would want to permanently keep a field hidden

Proposed solution

Keeping hidden consistent with disabled and readonly by making second parameter optional and taking it as true for that case which will allow

hidden(SchemaPath)

Alternatives considered

Currently doing: hidden(SchemaPath, () => true) for those cases

[Although there very few such cases, the above can be done and the inconvenience is very minor, I feel like its better to maintain consistency]

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: formsgemini-triagedLabel noting that an issue has been triaged by gemini

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions