vn/ui / Docs / Components

Currency Input

Format Vietnamese đồng with exact integer amounts.

Preview

₫
Numeric value1500000

The Code tab uses the common @/* alias. Import the copied file from the directory in vnui.json if your app uses a different path.

Installation

Initialize vn/ui in your app, then add this component.

npx @naminc/vnui@latest add currency-input

Usage and variants

The output is a bigint or null. Keep integer precision when persisting large amounts by serializing the value to a decimal string.

<CurrencyInput symbol="VND" max={5000000n} />

API

PropTypeBehavior
value, defaultValuebigint | nullControlled value or initial uncontrolled value.
onValueChange(value) => voidReceives the next value; connect it to form state or React Hook Form Controller.
label, name, disabled, classNamestring, string, boolean, stringVisible label, form name, disabled state and CSS class.
min, maxbigintInclusive validation bounds.
symbolstringTrailing currency symbol.

Use value and onValueChange for controlled fields, including React Hook Form Controller. Use defaultValue for standalone fields. label, name, disabled and className customize the field.

Accessibility

Fields have visible labels and keyboard focus. Searchable selectors support typing, arrow keys, Enter and Escape; date controls use browser keyboard behavior.

Amounts outside min or max set aria-invalid and show an inline error linked to the input.