Properties
| Property | Type | Description |
|---|---|---|
path | string | (optional) JSON Pointer to define the object key for all the generated nested field data. When provided, Form.Isolation will inherit schema validation from the parent Form.Handler for fields within this path. |
transformOnCommit | function | (optional) Transform the data before it gets committed to the form. The first parameter is the isolated data object. The second parameter is the outer context data object (Form.Handler). |
commitHandleRef | React.RefObject | (optional) Provide a ref to a function that can be called from any location to commit the data to the form. |
bubbleValidation | boolean | (optional) Prevent the form from being submitted when there are fields with errors inside the Form.Isolation. |
preventUncommittedChanges | boolean | (optional) Prevents uncommitted changes before the form is submitted. Will display an error message if user tries to submit without committing their changes. |
resetDataAfterCommit | boolean | (optional) If set to true, the Form.Isolation will reset its data context after committing the data to the outer context. |
dataReference | IsolationDataReference | (optional) Provide a reference by using Form.Isolation.createDataReference. |
defaultData | object | (optional) Default source data, only used if no other source is available, and not leading to updates if changed after mount. |
data | object | (optional) Dynamic source data used as both initial data, and updates internal data if changed after mount. |
id | string Function Object React.Context | (optional) Unique id for connecting Form.Handler and helper tools such as Form.useData. |
schema | object | (optional) JSON Schema for validation of the data set. IMPORTANT: When using JSON Schema validation, you MUST provide an ajvInstance prop. |
errorMessages | object | (optional) Object containing error messages by either type of JSON Pointer path and type. The messages can be a React.ReactNode or a string. |
ajvInstance | ajv | (optional) REQUIRED when using JSON Schema validation. Provide your own custom Ajv instance: import Ajv from "@dnb/eufemia/extensions/forms" and pass ajvInstance={makeAjvInstance()}. This ensures your bundle only includes AJV when you actually need it. More info in the Schema validation section. |
transformIn | function | (optional) Mutate the data context (internally as well) based on your criteria: ({ path, value, data, props, internal }) => 'new value'. It will iterate on each data entry (/path). |
transformOut | function | (optional) Mutate the data before it enters onSubmit or onChange based on your criteria: ({ path, value, data, props, internal }) => 'new value'. It will iterate on each data entry (/path). |
required | boolean | (optional) Make all fields required. |
disabled | boolean | (optional) Disable all fields. |
locale | string | (optional) Locale (language) to use for all nested Eufemia components. |
countryCode | ISO 3166-1 alpha-2 Path/JSON Pointer | (optional) Will change the country code for fields supporting countryCode. You can also set a path as the value, e.g. /myCountryCodePath. |
children | React.Node | (required) Contents. |
Translations
More info about translations can be found in the general localization and Eufemia Forms localization docs.
| Key | nb-NO | en-GB | sv-SE | da-DK |
|---|---|---|---|---|
Isolation.commitButtonText | Legg til | Add | Lägg till | Tilføj |
Isolation.preventUncommittedChangesText | Du har endringer som enten må legges til eller nullstilles. | You have changes that either need to be added or cleared. | Du har ändringar som antingen måste läggas till eller rensas. | Du har ændringer, som enten skal tilføjes eller nulstilles. |