Currency
The currency preset formats the input as a monetary value. The default configuration follows the Turkey format (comma for decimals, dot for thousands).
Raw Value
Display Value
import { useViraMask } from '@virastack/input-mask';
import { useForm } from 'react-hook-form';
const form = useForm();
const { amount } = useViraMask({
form,
schema: {
amount: 'currency'
},
});
<input {...amount} />Customize
You can customize the currency symbol, its position, and the separators to match different locales. The following example demonstrates how to configure it for US Dollar (dot for decimals, comma for thousands, and suffix symbol).
Raw Value
Display Value
import { useViraMask } from '@virastack/input-mask';
import { useForm } from 'react-hook-form';
const form = useForm();
const { amount } = useViraMask({
form,
schema: {
amount: {
currency: {
symbol: '$',
symbolPosition: 'suffix',
decimalSeparator: '.',
thousandSeparator: ',',
}
},
},
});
<input {...amount} placeholder="10,000.00 $" />For more details, see the Mask Options page.
