Skip to content

Commit

Permalink
docs: add documentation about emptyValue (#4174)
Browse files Browse the repository at this point in the history
Closes #4070
  • Loading branch information
tujoworker authored Oct 24, 2024
1 parent e6d3dce commit 52457ba
Showing 1 changed file with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down

0 comments on commit 52457ba

Please sign in to comment.