Component v1.1.0 Forms

Input

Text input with floating labels, semantic intent, password reveal, smart counters, validation, and Angular forms support.

API Stable 2.1 WCAG notes Ready Dark mode
Selector
ui-input
Package
@ngnova/ui/input

Import

Standalone Tailwind v4
import { UiInputComponent } from '@ngnova/ui/input';

Usage & variants

Live examples use the public ui-input API, paired with the exact snippet a product team would paste into an Angular app.

API Reference

Reactive forms

Connect the input to Angular forms while keeping labels, autocomplete, and support text together.

We will only use this for account updates.

Sizes and appearances

Use size for layout density and appearance for the surrounding surface treatment.

Prefixes and suffixes

Project short, non-editable context before or after the value without putting it in the label.

https:// .ngnova.app
$ USD

Clear and submit

Make temporary queries easy to reset and handle Enter without reaching into the native input.

Last submitted query: None

Password reveal

Add an accessible visibility toggle while preserving the password input contract.

Use at least 12 characters.

Validation and intent

Pair semantic field states with useful messages; explicit errors take danger priority.

This username is available.

Counters and field states

Show hard character limits, soft word limits, and non-editable states with the same API.

Keep it concise.

20 / 24

4 / 8

Production guidance

Use these notes to decide when the component belongs in a product workflow and what to verify before shipping.

When to use

Use for short single-line values where native input semantics are correct and assistive text matters.

Watch for

Provide ariaLabel or a visible/hidden label for icon-only or search-only inputs.

Product recipes

Apply Input in distinct, copyable product scenarios—not just an isolated component state.

Floating validated field

Use semantic intent for positive or warning guidance before validation fails.

Angular template ui-input-recipe.example.html
1
2
3
4
5
6
7
8
9
10
11
<ui-input
  label="Email"
  type="email"
  autocomplete="email"
  labelMode="floating"
  intent="success"
  helperText="Use your organization email."
  clearable
  [maxLength]="80"
  [formControl]="email"
/>

Field intelligence

Password reveal, word counters, clear behavior, and Enter submission are built in.

Angular template ui-input-recipe.example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<ui-input
  label="Deploy token"
  type="password"
  labelMode="floating"
  helperText="Reveal is opt-in and emits passwordVisibilityChange."
  revealable
  [formControl]="token"
/>

<ui-input
  label="Prompt summary"
  helperText="Word counts are useful for AI prompts and editorial fields."
  counterMode="words"
  [counterMax]="8"
  clearable
  [formControl]="summary"
  (submitted)="runSearch($event)"
/>

API Reference

Inputs and outputs are semver-sensitive public API. Keep examples aligned with this table.

Inputs

label ''
string

Visible field label.

placeholder ''
string

Native input placeholder.

helperText ''
string

Support text shown below the field.

errorText ''
string

Error text shown below the field and reflected in aria-invalid.

type 'text'
'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url'

Native input type.

size 'md'
'sm' | 'md' | 'lg'

Input height and text scale.

appearance 'outline'
'outline' | 'filled'

Visual field treatment for standard or denser form surfaces.

intent 'default'
'default' | 'success' | 'warning' | 'danger'

Semantic field intent. Angular invalid state automatically takes danger priority.

labelMode 'top'
'top' | 'floating' | 'hidden'

Label placement. Hidden keeps an accessible label while removing visual label text.

inputId generated
string

ID applied to the native input.

name ''
string

Native input name.

autocomplete ''
string

Native autocomplete value.

inputMode ''
string

Native inputmode value for mobile keyboards.

ariaLabel ''
string

Accessible label when no visible label is provided.

validationMessages {}
Record<string, string>

Custom validation messages keyed by Angular validation error name.

clearLabel 'Clear input'
string

Accessible label and fallback text for the clear action.

showPasswordLabel 'Show password'
string

Accessible label and fallback text for revealing a password field.

hidePasswordLabel 'Hide password'
string

Accessible label and fallback text for hiding a revealed password field.

counterMode 'characters'
'characters' | 'words'

Counter strategy for character-limited or word-limited fields.

maxLength null
number | null

Native maxlength constraint.

minLength null
number | null

Native minlength constraint.

counterMax null
number | null

Counter-only limit. Use this for word counts or soft limits without native maxlength.

disabled false
boolean

Disables the native input.

readonly false
boolean

Makes the native input read-only.

required false
boolean

Marks the native input as required.

clearable false
boolean

Shows a keyboard-reachable clear button when the field has a value.

hideCounter false
boolean

Hides the character or word counter when a counter limit is set.

revealable false
boolean

Shows a keyboard-accessible password visibility toggle for password inputs.

Outputs

valueChange OutputEmitterRef<string>

Emits the current value on input.

focused OutputEmitterRef<FocusEvent>

Emits when the input receives focus. The host also forwards a native focus event.

blurred OutputEmitterRef<FocusEvent>

Emits when the input loses focus. The host also forwards a native blur event.

cleared OutputEmitterRef<void>

Emits when the clear button resets the current value.

submitted OutputEmitterRef<string>

Emits the current value when Enter is pressed inside the input.

passwordVisibilityChange OutputEmitterRef<boolean>

Emits after the password reveal state changes.

Accessibility

  • Visible labels are connected with the native input using for/id.
  • labelMode="hidden" renders a screen-reader-only label instead of relying on placeholder text.
  • Helper, error, and counter text are wired through aria-describedby.
  • Invalid state sets aria-invalid and error text uses role="alert".
  • Clear and password reveal actions are native buttons with configurable accessible labels.
  • Projected prefix and suffix content should be decorative or supplemental; the label remains the accessible name.

Keyboard behavior

  • Tab moves focus to the native input.
  • Typing updates the value and emits valueChange.
  • Focus and blur are available as focused and blurred Angular outputs, with native focus and blur events forwarded on the host for HTML-friendly listeners.
  • The clear button is reachable by Tab when visible.
  • Enter emits submitted with the current string value.
  • Password reveal is keyboard reachable and exposes aria-pressed.
  • Projected suffix shortcuts must not replace the submitted output or native keyboard behavior.

Testing guidance

  • Assert CVA writeValue does not emit valueChange, typing does emit valueChange, touched state, disabled state, validation message, clear button, prefix/suffix projection, and counter behavior.
  • Test floating labels, intent classes, passwordVisibilityChange, word counters, and submitted output when the application uses those features.