QdsNumericInput

Do not use qds-numeric-input for identifiers that merely look numeric — account numbers, CUSIPs, phone numbers. Those are text: they have leading zeros, they are never arithmetic, and thousands separators would corrupt them. Use qds-text-input with a pattern. This distinction is the single most common mistake in financial UIs.

Overview

The qds-numeric-input component is a form-associated custom element for numeric, currency, and percentage entry. It maintains a strict three-layer value contract so nothing rounds by accident:

Display formatting is presentation only and never feeds back into value. On focus, display collapses to the editable canonical form. On blur, it re-formats. The user always edits the number they typed and always reads it formatted.

Percent convention

value is the number the user sees. 12.5 with mode="percent" displays 12.5% and submits "12.5". It does not submit "0.125". Silent x100 conversion is a defect factory — this component never converts.

Rounding convention

Rounding on blur is to decimals when set, using half-up (not half-even). Half-even would be defensible for statistics; half-up matches what a finance user expects from a data-entry field.

Usage

<qds-numeric-input label="Quantity" value="100" step="10"></qds-numeric-input>
<qds-numeric-input mode="currency" currency="USD" value="1234.56" label="Amount"></qds-numeric-input>
<qds-numeric-input mode="percent" value="12.5" decimals="2" label="Rate"></qds-numeric-input>
<qds-numeric-input mode="currency" currency="EUR" locale="de-DE" value="-1234" negative-style="parens" label="Balance"></qds-numeric-input>

API Reference

Attributes

Properties

CSS Parts

CSS Custom Properties

Events

Keyboard

Paste

Paste is sanitised: strip currency symbols, spaces, grouping separators, and parentheses; convert (1,234) to -1234; reject anything that is not a valid number with no value change.

Example

<form>
  <qds-numeric-input
    mode="currency"
    currency="USD"
    label="Invoice Amount"
    value="1500.00"
    min="0"
    step="50"
    steppers
    required
    hint="Minimum $0"
  ></qds-numeric-input>
  <button type="submit">Submit</button>
</form>

<script type="module" src="https://cdn.q360.ai/assets/components/numeric-input/qds-numeric-input.js"></script>