Skip to content
Cynco UI

Productivity

AmountInput

The money field accountants type into: accepts plain figures, “1,234.50”, accounting brackets “(500)”, “1.2k” and formulas like “=1200*1.08” or “100+250.50-20”, and commits an exact decimal string.

import { AmountInput } from "@cynco-labs/ui";

Example

Use

Anywhere a user enters an amount. While focused it shows exactly what was typed (with a live “= RM 1,296.00” hint for formulas); on blur or Enter it evaluates and shows the formatted, right-aligned figure.

Props

value / defaultValue (decimal string, "" for empty), onValueChange(value: string), currency? (adds the symbol prefix via InputGroup and formats the hint), allowNegative?, invalid? + errorMessage?, placeholder?, messages? ("below" for forms, "overlay" for grids), onAutoFill? (what “=” then Enter fills), onParseError?, inputClassName?, className (root) and any native input props (aria-*, name, disabled, onBlur…). Forwards its ref to the <input>.

Notes

Maths via parseAmount / toSen (BigInt, half-up), so 0.1 + 0.2 is 0.30. Fills its container's width; negatives display bracketed in text-error-text.

Source Demo source Markdown