Skip to main content
The number custom element renders a numeric input with optional prefix/suffix adornments, decimal precision, and range checks. Use it for merchant-defined quantities, monetary amounts, or rates.

Factory

Example

Options

NumberAdornment

  • 'inset' overlays the adornment inside the input chrome. Best for short symbols ($, %).
  • 'tab' renders the adornment as a separate chip glued to one edge of the input. Best for short text labels (USD, kg).
Each side chooses its style independently. Adornments are non-interactive; clicks anywhere in the field focus the input.

Mode and precision

  • mode: 'integer' allows digits and a leading - only.
  • mode: 'decimal' allows digits, a single ., and a leading -.
  • precision caps how many decimal places the input accepts. Characters past the cap are blocked while typing. A defaultValue whose decimal part exceeds the cap is truncated on the right at mount.
  • precision does not pad with trailing zeros. Values type-check as number, so the emitted value is exactly what shoppers see.

Range checks

min and max run when validate is not supplied. Empty inputs (null after parse) skip the range check; the required check owns emptiness. Providing validate skips every built-in check.

Value

null while the input is empty or mid-typing an incomplete number ('-', '.', '-.', '1.'). The next keystroke that resolves to a finite number flips value back to the parsed shape. For arbitrary-precision arithmetic (currency rounding beyond four decimals), read element.value for the raw display string and apply your own decimal library downstream.

Inside Checkout

See also

Last modified on July 17, 2026