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

Input

Single-line text control with a public value model and Angular 22 Signal Forms integration.

Category
Forms and selection
Import
@neural-ui/core/input
Selector
neu-input
import { NeuInputComponent } from '@neural-ui/core/input';

Overview

NeuInput wraps a native single-line input. Its public value model belongs to the application or FormField; label, hint, size and optional icon presentation are inputs, not a validation engine.

Basic value model

Connect value to a signal and provide a label. Typing updates the signal; changing the signal updates the field.

Basic value model

Visible to your team

Value: โ€”

Configurator

Configure type, size, floating label, placeholder and hint. Try interaction and validation states; the generated template follows your settings.

Configurator

Live preview

Generated template. The Code tab includes imports and state.

template.html
<neu-input
  [(value)]="text"
  label="Customer name"
  type="text"
  size="md"
  [floatingLabel]="true"
/>

Disabled and readonly

Disabled removes the native input from keyboard focus and blocks edits. Readonly keeps it focusable and readable but blocks edits; it is not the same as disabled. These are direct component inputs here, outside FormField.

Disabled and readonly
Applied value: Draft

Signal Forms

Bind FormField to the control and define validation in the form schema. This example lets you edit, validate and reset the same field, including disabled and readonly states.

Signal Forms foundation ยท State ownership

Signal Forms
Value: โ€”

touched: false ยท dirty: false ยท valid: false ยท invalid: true

Validation and error state

Angular's form schema decides validity; NeuInput only renders supplied invalid/errors state and an explicit errorMessage. It sets aria-invalid and links its visible error or hint through aria-describedby. The demo reveals an error message after interaction; it does not claim the component validates minLength itself.

Model ownership and events

Use [(value)] for two-way editing, or [value] with (valueChange) when you need an explicit handler. The touch event reports blur; it does not contain the field value.

Accessibility and keyboard

Core associates the label with the native field, connects hint/error text, and reflects disabled, readonly, required and invalid state. Standard text-editing keys remain native.

Your application supplies a meaningful label, validation rules and understandable errorMessage text. Use distinct inputId values when assigning IDs yourself.

Accessibility foundation

Key
Action
Tab Focuses the native input unless disabled; editing keys remain browser behavior.

API

value supports two-way binding. touch reports blur. Inputs configure the field and the form state it displays; the tables below show their types, defaults and binding syntax.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
autocompletestring'off'[autocomplete]Native autocomplete hint for the text field.
dirtybooleanfalse[dirty]Applied dirty state, normally supplied by FormField.
disabledbooleanfalse[disabled]Disables the native input and removes it from keyboard focus.
endIconbooleanfalse[endIcon]Enables the projected trailing icon slot.
errorMessagestring''[errorMessage]Explicit visible error text when error state is present.
errorsreadonly ValidationError.WithOptionalFieldTree[][][errors]Applied validation errors, normally from the form schema.
floatingLabelbooleantrue[floatingLabel]Switches between floating and static label presentation.
hiddenbooleanfalse[hidden]Hides the component host.
hintstring''[hint]Help text linked to the native input when no visible error takes precedence.
iconstring | nullnull[icon]Optional application-resolved semantic icon key.
iconPosition"left" | "right"'left'[iconPosition]Places the named icon to the left or right.
inputIdstringinject(NeuIdGenerator).getId('neu-input-')Derived default[inputId]ID shared by the native input and its label/help references.
invalidbooleanfalse[invalid]Applied invalid flag; it does not run a validator.
labelstring''[label]Visible label associated with the native input.
maxstring | undefinedundefined[max]Forwarded max attribute. Supported text types do not use numeric/date bounds; use maxLength or a form rule for text.
maxLengthnumber | undefinedundefined[maxLength]Native maximum text length.
minstring | undefinedundefined[min]Forwarded min attribute. Supported text types do not use numeric/date bounds; use minLength or a form rule for text.
minLengthnumber | undefinedundefined[minLength]Native minimum text length; form-schema validation is separate.
namestring''[name]Native form-control name.
patternreadonly RegExp[][][pattern]Applied regular-expression list; one expression can become a native pattern.
pendingbooleanfalse[pending]Applied pending state announced through aria-busy.
placeholderstring''[placeholder]Placeholder for static-label presentation.
readonlybooleanfalse[readonly]Keeps the native input focusable while blocking edits.
requiredbooleanfalse[required]Marks the native input required; schema validation is owned by the form.
size"sm" | "md" | "lg"'md'[size]Small, medium or large control size.
startIconbooleanfalse[startIcon]Enables the projected leading icon slot.
touchedbooleanfalse[touched]Applied touched state, normally supplied by FormField.
typeNeuInputType'text'[type]Public native input-type choice constrained by NeuInputType.

Models

A model supports [(property)]="signal" or the [property] and (propertyChange) pair. Choose one form, not both.

Name
Type
Default
Template binding
Description
valuestring''[(value)]Bidirectional text model owned by the application or FormField.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
touchvoid(touch)="onTouch($event)"Lifecycle notification emitted when the native input blurs.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

Name
Mechanism
Contract
[neu-input-start]

Before the field

Content projection

The example places a prefix and an action button in the field slots.

<ng-content select="[neu-input-start]" />

Context used: โ€”

[neu-input-end]

After the field

Content projection

The example places a prefix and an action button in the field slots.

<ng-content select="[neu-input-end]" />

Context used: โ€”

Usage example

Enable the areas with [startIcon]="true" and [endIcon]="true", then place content inside the field using neu-input-start and neu-input-end. These selectors are for projection; startIcon and endIcon are inputs. This example shows decorative units and names the currency in the label. No icon resolver is needed.

Customize content
Amount: 125.00 USD

Public Types

Open a type to inspect its definition and interface fields.

Theming

The public --neu-input-* tokens below customize background, border and focus treatment. Typography, radius and shared colors come from the global Core theme.

Specific tokens

Token
Purpose
State / variant
Default / source
Fallback
--neu-input-background Field and floating-label background. Field surface var(--neu-surface)Component fallback--neu-surface
--neu-input-border Field border outside focus and invalid states. Unfocused, valid field var(--neu-border)Component fallback--neu-border
--neu-input-focus-border Focused field border; invalid state takes precedence. Focus without error var(--neu-primary)Component fallback--neu-primary
--neu-input-focus-ring Normal focus ring; invalid focus uses the shared error color. Focus without error var(--neu-focus-ring)Component fallback--neu-focus-ring

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
--neu-border Normal control and cell borders Shared by other Core consumers; scope the override. rgba(15, 23, 42, 0.08)
--neu-border-hover Control borders on hover Shared by other Core consumers; scope the override. rgba(15, 23, 42, 0.16)
--neu-error Invalid field or danger-action color Shared by other Core consumers; scope the override. #dc2626
--neu-error-text Error text and danger outline/ghost Button text in both themes Shared by other Core consumers; scope the override. #991b1b
--neu-focus-ring Normal keyboard-focus ring Shared by other Core consumers; scope the override. 0 0 0 var(--neu-focus-ring-width) rgba(0, 122, 255, 0.15)
--neu-focus-ring-alpha Opacity of the semantic focus ring Shared by other Core consumers; scope the override. 25%
--neu-focus-ring-width Ring thickness, including invalid focus Shared by other Core consumers; scope the override. 3px
--neu-primary Brand color for active controls and emphasis Shared by other Core consumers; scope the override. #007aff