Skip to content

Properties

Field-specific properties

PropertyTypeDescription
decimalLimitnumber(optional) Max number of decimals. Values with more decimals will be rounded. Defaults to 12.
percentboolean(optional) Format a number as percentage.
currencyboolean
string
(optional) Currency code (ISO 4217) or true to use the default NOK. Uses two decimals by default.
allowNegativeboolean(optional) Whether or not to allow negative numbers. Defaults to true.
disallowLeadingZeroesboolean(optional) Whether or not to allow leading zeroes during typing. Defaults to false.
minimumnumber(optional) Validation for inclusive minimum number value (greater than or equal). Defaults to Number.MIN_SAFE_INTEGER.
maximumnumber(optional) Validation for inclusive maximum number value (less than or equal). Defaults to Number.MAX_SAFE_INTEGER.
exclusiveMinimumnumber(optional) Validation for exclusive minimum number value (greater than).
exclusiveMaximumnumber(optional) Validation for exclusive maximum number value (less than).
multipleOfnumber(optional) Validation that requires the number to be a multiple of given value.
widthstring
false
(optional) false for no width (use browser default), small, medium or large for predefined standard widths, stretch for fill available width.
sizestring
number
(optional) The sizes you can choose is default (2rem), medium (2.5rem) and large (3rem) are supported component sizes. Defaults to default / null. Also, if you define a number like size={2} then it will be forwarded as the input element attribute. Consider rather setting field sizes with Form.Appearance.
alignstring(optional) Lateral alignment of contents of input field, one of left (default), center, or right.
autoCompleteon
string
(optional) For HTML autocomplete attributes.
prefixstring(optional) Text added before the value input.
suffixstring(optional) Text added after the value input.
stepnumber(optional) Determines step granularity when in/decreasing value input through step controls buttons or arrow keys. Defaults to 1.
startWithnumber(optional) When no value or defaultValue is given, start with a given value when in/decreasing value input through step controls buttons or arrow keys. Defaults to null.
showStepControlsboolean(optional) Show buttons that in/decreases value input by the step value.
maskarray
function
(optional) An array or a function returning an array of regexes to use as a mask for the input. If not given, the input will not be masked.

General properties

PropertyTypeDescription
valuenumber(optional) Source data value for the field. Will take precedence over the path value given in the data context.
defaultValuenumber(optional) Default source data value for the field. Will not take precedence over the path value given in the data context.
pathstring(optional) JSON Pointer for where the data for the field is located in the source dataset (when using Form.Handler or DataContext). The path will also be set as the name attribute for the string-field.
infoReact.Node
Array<React.Node>
function
(optional) Info message shown below / after the field. When provided as a function, the function will be called with the current value as argument. The second parameter is an object with { conditionally, getValueByPath, getFieldByPath }. To show the message first after the user has interacted with the field, you can call and return conditionally function with a callback and with options: conditionally(() => 'Your message', { showInitially: true })
warningReact.Node
Array<React.Node>
function
(optional) Warning message shown below / after the field. When provided as a function, the function will be called with the current value as argument. The second parameter is an object with { conditionally, getValueByPath, getFieldByPath }. To show the message first after the user has interacted with the field, you can call and return conditionally function with a callback and with options: conditionally(() => 'Your message', { showInitially: true })
errorError
FormError
Array<Error | FormError>
function
(optional) Error message shown below / after the field. When provided as a function, the function will be called with the current value as argument. The second parameter is an object with { conditionally, getValueByPath, getFieldByPath }. To show the message first after the user has interacted with the field, you can call and return conditionally function with a callback and with options: conditionally(() => 'Your message', { showInitially: true })
disabledboolean(optional) Set true to show the field but without the possibility of changing the value.
emptyValuenumber
undefined
(optional) The value to use (in onChange events etc) when emptying the field. Makes it possible for instance to provide undefined instead of an empty string when clearing the content of a text input.
requiredboolean(optional) When set to true, the field will give an error if the value fails the required validation. When set to false, the field will not be required, but will add a "(optional)" suffix to the label.
labelSuffixReact.Node(optional) Will append an additional text to the label, like "(optional)". When using inheritLabel, the suffix will not be inherited. NB: The visual appearance of the labelSuffix may change in the future.
schemaobject(optional) Custom JSON Schema for validating the value.
validateInitiallyboolean(optional) Set to true to show validation based errors initially (from given value-prop or source data) before the user interacts with the field.
validateUnchangedboolean(optional) Set to true to show validation based errors when the field is touched (like focusing a field and blurring) without having changed the value. Since the user did not introduce a new error, this will apply when the value was initially invalid based on validation.
validateContinuouslyboolean(optional) Set to true to show validation based errors continuously while writing, not just when blurring the field.
errorMessagesobject(optional) Custom error messages for each type of error, overriding default messages. The messages can be a React.ReactNode or a string.
onChangeValidatorfunction(optional) Custom validator function where you can return undefined, Error, FormError or an Array with either several other validators or several Error or FormError. It is triggered on every change done by the user. The function can be either asynchronous or synchronous. The first parameter is the value, and the second parameter returns an object containing { errorMessages, connectWithPath, validators }.
onBlurValidatorfunction(optional) Custom validator function where you can return undefined, Error, FormError or an Array with either several other validators or several Error or FormError. It is triggered when the user leaves a field (e.g., blurring a text input or closing a dropdown). The function can be either asynchronous or synchronous. The first parameter is the value, and the second parameter returns an object containing { errorMessages, connectWithPath, validators }.
transformInfunction(optional) Transforms the value before its displayed in the field (e.g. input).
transformOutfunction(optional) Transforms the value before it gets forwarded to the form data object (context) or returned as the onChange value parameter. The first parameter is the internal value. Some fields do support a second parameter, like the SelectCountry, where the country object is given.
labelstring(optional) Field label to show above / before the input feature.
labelDescriptionstring(optional) A more discreet text displayed beside the label (i.e for "(optional)").
labelDescriptionInlineboolean(optional) If true, the labelDescription will be displayed on the same line as the label.
labelSrOnlyboolean(optional) Use true to make the label only readable by screen readers.
labelSizemedium
large
(optional) Define the font-size of the label based on the font-size table.
helpobject(optional) Provide help content for the field using title and content as a string or React.Node. Additionally, you can set open to true to display the inline help, set the breakout property to false to disable the breakout of the inline help content, or use renderAs set to dialog to render the content in a Dialog (recommended for larger amounts of content).
layoutstring(optional) Layout for the label and input. Can be horizontal or vertical.
layoutOptionsobject(optional) Use this to set additional options for the horizontal layout. E.g. { width: "medium" }. You can also use a custom width {number}rem. Instead of a width, you can use a min/max width. E.g. { minWidth: "6rem", maxWidth: "12rem" }.
widthstring
false
(optional) Will set the width for the whole block. Use small, medium, large for predefined standard widths. You can also set a custom width {number}rem or use stretch or false.
contentWidthstring
false
(optional) Will set the width for its contents. Use small, medium, large for predefined standard widths. You can also set a custom width {number}rem or use stretch or false.
Spacestring
object
(optional) Spacing properties like top or bottom are supported.

Translations

More info about translations can be found in the general localization and Eufemia Forms localization docs.

Keynb-NOen-GBsv-SEda-DK
NumberField.errorMinimumVerdien må minst være {minimum}.The value must be at least {minimum}.Värdet måste vara minst {minimum}.Værdien skal være mindst {minimum}.
NumberField.errorMaximumVerdien må maksimalt være {maximum}.The value must be a maximum of {maximum}.Värdet får vara högst {maximum}.Værdien må højst være {maximum}.
NumberField.errorExclusiveMinimumVerdien må være større enn {exclusiveMinimum}.The value must be greater than {exclusiveMinimum}.Värdet måste vara större än {exclusiveMinimum}.Værdien skal være større end {exclusiveMinimum}.
NumberField.errorExclusiveMaximumVerdien må være mindre enn {exclusiveMaximum}.The value must be less than {exclusiveMaximum}.Värdet måste vara mindre än {exclusiveMaximum}.Værdien skal være mindre end {exclusiveMaximum}.
NumberField.errorMultipleOfVerdien må være et multiplum av {multipleOf}.The value must be a multiple of {multipleOf}.Värdet måste vara en multipel av {multipleOf}.Indtast en værdi, der går op i {multipleOf}.
NumberField.errorIntegerVerdien må være et heltall (uten desimaler).The value must be an integer (no decimals).Värdet måste vara ett heltal (utan decimaler).Værdien skal være et helt tal (uden decimaler).
Field.errorSummaryTitleFeil som må rettesPlease correct the following errorsFel som måste åtgärdasFelter der skal rettes
Field.stateSummaryOppsummering:Summary:Sammanfattning:Oversigt:
Field.errorSummaryFeil som må rettes:Please correct the following errors:Fel som måste åtgärdas:Felter der skal rettes:
Field.errorRequiredDette feltet må fylles ut.This field is required.Detta fält måste fyllas i.Dette felt skal udfyldes.
Field.errorPatternVerdien er ugyldig.The value is invalid.Värdet är ogiltigt.Ugyldig værdi.
Field.optionalLabelSuffix(valgfritt)(optional)(valfritt)(valgfrit)