Events
| Property | Type | Description |
|---|---|---|
onChange | (value?: string, additionalArgs?: object) => void | (optional) Will be called on value changes made by the user, with the new value as argument. When an async function is used, the corresponding FieldBlock will show an indicator on the field label. You can return { success: 'saved' } as const to show a success symbol, or an error or an object with these keys { info: 'Info message', warning: 'Warning message', error: Error('My error') } as const. The second parameter is an object that e.g. contains props (all given Field.* properties). |
onFocus | (value?: string, additionalArgs?: object) => void | (optional) Will be called when the component gets into focus. Like clicking inside a text input or opening a dropdown. Called with active value as argument. The second parameter is an object that e.g. contains props (all given Field.* properties). |
onBlur | (value?: string, additionalArgs?: object) => void | (optional) Will be called when the component stop being in focus. Like when going to next field, or closing a dropdown. Called with active value as argument. The second parameter is an object that e.g. contains props (all given Field.* properties). |
Details about argument values
The event handlers has two arguments. The first one is a string containing the ISO of the selected currency, e.g. CHF, and the second argument is an object with the properties continent, i18n, decimals and iso.
(value?: string, // e.g. "CHF"additionalArgs?: {i18n: {en: string, // e.g. "Swiss franc"nb: string // e.g. "Sveitsisk franc"},iso: string, // e.g. "CHF"continent: string, // e.g. "Europe"name: string, // e.g. "Swiss franc"decimals: number, // e.g. 2regions?: string[] // e.g ["Scandinavia", "Nordic"]}) => void