Overview

tng-number-input is a standalone number input that implements ControlValueAccessor for Angular forms. It supports min, max, step, optional clamping on blur, and Tailng’s slot-based micro styling.

CVA min / max / step Clamp on blur Slot styling Standalone
Reactive Forms

Quick example

Basic
HTMLTSCSS

<form [formGroup]="form">
  <tng-number-input
    formControlName="quantity"
    placeholder="Quantity"
    [min]="0"
    [max]="100"
    [step]="1"
  />
</form>

Works with formControlName; value is number | null.

Decimal step
HTMLTSCSS

<form [formGroup]="form">
  <tng-number-input
    formControlName="amount"
    placeholder="Amount (0–1000, step 0.01)"
    [min]="0"
    [max]="1000"
    [step]="0.01"
    [slot]="customSlot"
  />
</form>

Use [step]="0.01" for decimals; value is clamped to min/max on blur.

With prefix icon
HTMLTSCSS

<form [formGroup]="form">
  <tng-number-input
    placeholder="Amount"
    [slot]="prefixSlot"
  >
    <tng-icon
      tngPrefix
      name="bootstrapCurrencyDollar"
      class="ml-3 text-muted"
    />
  </tng-number-input>
</form>

Use [tngPrefix] and [tngSuffix] for icons/actions.

Features

min / max / step

Native HTML attributes for validation and browser stepper. Optional clamping to min/max on blur.

Value: number | null

Empty input yields null; otherwise a number. NaN is converted to null.

Slot-based micro styling

Customize styling via the slot input with keys: frame, input, prefix, suffix.

Prefix / Suffix slots

Project icons or actions before/after the input using tngPrefix / tngSuffix.

Forms-ready

Full ControlValueAccessor integration for reactive and template-driven forms.

Tip: Use inputmode="numeric" or inputmode="decimal" for better mobile keypad behavior.