Skip to main content
Neural UIv2.0.0Documentation
View v1 GitHub

Signal Forms

Connect one field, add validation, control field state and build a small working form.

Start with one Input

The application signal holds the data. form creates the field tree, and FormField connects the Neural Input to its field. Type below and watch the same data value update. Do not add [(value)] beside [formField].

Start with one Input
Value: Neural

Validation, messages and interaction state

This field adds required and minLength(3). Visit it and leave it empty to see the required message; enter one character to see the minimum-length message. A required empty value is invalid from the start, before touched becomes true.

The schema supplies invalid and errors to Input. errorMessage is text chosen by the application. touched decides when this example shows that text; it does not remove the invalid border. Type a valid value to clear the error.

Validation, messages and interaction state
touched: false ยท dirty: false ยท valid: false

Understand field state

Use the switches above to compare disabled and readonly. Schema rules own these states. readonly prevents editing while preserving a usable field; disabled is a different participation state. The Source includes both switches, all schema rules, state output and reset.

Field state
Meaning
Presentation
invalid / validWhether schema validation fails or succeeds.Not evidence of a previous interaction.
errorsValidation errors, including kind and rule details.Choose a message for required or minLength.
errorMessageText supplied by your application to Neural Input.Not the source of Signal Forms validity.
touchedThe field has been visited and left.Useful for deciding when to show error text.
dirtyThe field has been edited.Reset clears this interaction state.
disabled / readonlyDisabled excludes participation; readonly prevents editing without disabling the field.Use schema rules, not a competing binding.

Reset data and interaction state together

Reset in the validated example calls the field reset API and clears the two application switches. touched and dirty return to false. The empty required field remains invalid: reset is not validation success. Only replacing the data signal does not express the same reset of field interaction state.

signal-validation.example.ts ยท fragment
// Fragment from the validated Signal Forms example.
reset(): void {
  this.fields.text().reset('');
  this.isDisabled.set(false);
  this.readOnly.set(false);
}

Compose Input and Checkbox

Enter a name with at least three characters, choose whether to receive updates and save. The action prints the accepted form data; this example does not send a network request. Reset clears fields and the application result. Native form submission remains available from the keyboard.

Compose Input and Checkbox

Common mistakes

Use one value owner: FormField or an explicit model binding, not both. Neural signal controls implement the Signal Forms contract, not ControlValueAccessor: do not attach formControlName, formControl or ngModel to them. Import FormField in the standalone component that owns the template. Do not read invalid as if it meant touched. Reset field state, not just data. Do not treat readonly as disabled. Keep the field tree stable instead of recreating it on every interaction.