Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add documentation about emptyValue #4174

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading