diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/about-fields.mdx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/about-fields.mdx index 0996a815374..29318524e4f 100644 --- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/about-fields.mdx +++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/about-fields.mdx @@ -31,13 +31,17 @@ Here is a list of [all available fields](/uilib/extensions/forms/all-fields/). **Table of Contents** -- [Base fields](#base-fields) -- [Feature fields](#feature-fields) -- [More info](#more-info) - - - [Standardized properties](#standardized-properties) - - [Controlled \& Uncontrolled](#controlled--uncontrolled) - - [Creating custom field components](#creating-custom-field-components) +- [About fields](#about-fields) + - [Base fields](#base-fields) + - [Feature fields](#feature-fields) + - [More info](#more-info) + - [Empty value](#empty-value) + - [Standardized properties](#standardized-properties) + - [Controlled \& Uncontrolled](#controlled--uncontrolled) + - [Creating custom field components](#creating-custom-field-components) + - [Basic field usage](#basic-field-usage) + - [Complete state management and local custom fields](#complete-state-management-and-local-custom-fields) + - [First steps](#first-steps) ## Base fields @@ -58,6 +62,14 @@ On top of these, a number of [feature fields](#feature-fields) have been built t ## More info +### Empty value + +Every field has an `emptyValue` property that can be used to define what value should be used when the user does not enter any value. + +When a user removes its content from e.g. a string input field, the value will be set to the `emptyValue`. + +- The default `emptyValue` value is `undefined`. + ### Standardized properties All input component has a fixed set of properties that make it possible to build more complex standardized functionality around them. The most important ones here are `value` and `onChange` (can be async). Value expects values in the given data type, so for example `Field.Number` expects a `value` of the type `number`, and will give a type error in Typescript if it e.g. receives a number in a `string`. The callback function submitted to `onChange` will always receive the value of the corresponding type as the first argument.