Input
A single-line text field with an optional label, helper text and error message.
Installation
Usage
src/app/app.ts
[(value)]updates your signal on every keystroke. Setting the signal from code updates the field too.- The field shows a focus ring while it has focus.
classstyles the whole block of label, field and message, so use it for spacing such asclass="mt-4".
Helper text and errors
helperTextshows small muted text under the field.- A non-empty
errorreplaces the helper text with red text and turns the ring red. The field shakes when an error first appears.
Types
type goes to the underlying <input> element, which takes text, number and password.
Disabled
A disabled field dims and ignores typing.
Signal Forms
UiInput implements Angular's FormValueControl, so it works with the [formField] directive of Signal Forms (see Forms).
src/app/app.ts
