Forms

Numeric input

@xui/numeric-input

A number field with steppers and keyboard increment. The value is a number | null (empty is null, not 0). ArrowUp/Down step; Shift is the coarse jump, Alt the fine nudge. Full ControlValueAccessor.

Install

pnpm add @xui/numeric-input

Add the barrel to a standalone component's imports:

import { XuiNumericInputImports } from '@xui/numeric-input';

@Component({
  imports: [XuiNumericInputImports],
  // …
})

Examples

Default

Loading preview…

Bounded

Loading preview…

Small

Loading preview…

Buttons left

Loading preview…

No buttons

Loading preview…

API

XuiNumericInput

componentxui-numeric-input

A number field with stepper buttons and keyboard increment.

Inputs

NameTypeDefaultclassClassValueThe user-defined classes on the wrapper. Merged last so they win.''sizeXuiNumericInputSizeControl height, from the shared control scale. Also scales the stepper icons.this.config.sizebuttonPositionXuiNumericButtonPositionWhere the stepper buttons sit, or none to drop them and leave a plain numeric field.this.config.buttonPositionplaceholderstring | nullText shown while the field is empty.nullariaLabelstring | nullAccessible name for the field, when no <label> points at it.nullminnumber | undefinedLower bound. Reported as aria-valuemin and enforced when stepping; typed values are only clamped if clampValueOnBlur is set.undefinedmaxnumber | undefinedUpper bound. Reported as aria-valuemax and enforced when stepping; typed values are only clamped if clampValueOnBlur is set.undefinedstepSizenumberHow much one step changes the value — a button press, or an arrow key with no modifier.this.config.stepSizemajorStepSizenumberStep used while Shift is held, for coarse adjustment.this.config.majorStepSizeminorStepSizenumberStep used while Alt is held, for fine adjustment.this.config.minorStepSizeclampValueOnBlurbooleanPull a typed value back inside min/max when the field loses focus. Off by default, so an out-of-range entry stays visible to be corrected.this.config.clampValueOnBlurdisabledbooleanBlock interaction and dim the field and its steppers.falsevalueInputnumber | nullThe value, or null when empty. Two-way bindable as [(value)]; a string attribute is coerced to a number.null

Methods

step(delta: number): void

Source

libs/ui/numeric-input/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.