Form field reference for App Engine
All field types of a form in App Engine scripts with their properties, plus conditions, validation rules and sections.
POSTED: | UPDATED: | by Stefan Schüttenkopf
This page lists every field type you can put into a form in an App Engine script and the properties each one accepts. It applies to version 17.2. How to create and mount a form is described in Form configuration in AppEngine.
Field types at a glance
A field is an object in the fields array of a section. Its type decides what is rendered.
type | What the user sees | Value |
|---|---|---|
text, password | A single-line input. With password the input is masked. | string |
number | An input that accepts numbers only. | number |
textarea | A multi-line input. | string |
select | A drop-down list with one or several selectable options. | string or number, or an array of them |
checkbox | A checkbox. | boolean |
toggle | A switch. | boolean |
radio-group, radio-group-number | A group of radio buttons, with string or numeric values. | string or number |
button-group | A row of buttons of which one is selected. | string or number |
slider | A slider on a scale. | number or an array of numbers |
date-picker, only-date-picker, only-time-picker | A picker for date and time, date only or time only. | Date |
color | A color picker. | string (hex color) |
file | A file upload. | File |
label | Text without input. | none |
action | A button with an icon that runs your function. | none |
select-from-table | A field whose value is picked from a table in a dialog. | the selection made in the table |
Properties of every field
All field types accept these properties. The tables further down list only what a type adds.
| Property | Type | Required | Description |
|---|---|---|---|
name | DotNestedKeys<T> | yes | The name of the field, used to identify its value within the form. For nested objects, a dot-separated string is used (e.g., "parent.child"). |
grid | { xs: number; sm: number; md: number; lg: number; } | no | Defines the field's layout within a grid using system breakpoints.xs, sm, md, lg: Specify the field width for various screen sizes (from 1 to 12). Defaults to 12 for all breakpoints. |
label | string | no | The field label shown to the user. |
reValidateOnChange | Path<T>[] | string[] | no | One or more fields that determine when the field should be re-validated upon value change. |
sx | SxProps<Theme> | no | Custom styles (MUI system props) for the field wrapper. Built-in field components apply sx on their shared outer wrapper, so nested selectors can be used to style inner MUI elements per field instance. |
condition | Condition | Condition[] | no | Rules that change the field depending on the values of other fields. See Conditions. |
showRequiredAsterisk | boolean | no | Shows the asterisk for required fields next to the label. This is visual only. To make the field required, add a rule to validation. |
visible | boolean | no | Indicates whether the field is visible. |
disabled | boolean | no | Indicates whether the field is disabled. |
validation | Array<ValidationRules & { message?: string }> | no | The validation rules of the field, each with an optional message. See Validation rules. |
placeholder | string | no | Placeholder text shown inside the input. |
Use visible, disabled and showRequiredAsterisk when the value comes from your script. Use a condition when it depends on what the user enters in another field.
Text and password
type: 'text' or type: 'password'
| Property | Type | Required | Description |
|---|---|---|---|
asyncValidation | boolean | no | Indicates whether to show a loading indicator during asynchronous validation. |
placeholder | string | no | Text displayed as a placeholder inside the field. |
onChange | (value: string) => void | no | A callback function triggered when the field value changes. |
Number
type: 'number'
| Property | Type | Required | Description |
|---|---|---|---|
asyncValidation | boolean | no | Indicates whether to show a loading indicator during asynchronous validation. |
grouping | boolean | no | Determines whether to use digit grouping (e.g., thousand separators). Defaults to true. |
decimalSeparator | string | no | Specifies the character used as the decimal separator. Defaults based on locale. |
placeholder | string | no | Text displayed as a placeholder inside the field. |
onChange | (value: number) => void | no | A callback function triggered when the field value changes. Receives the current value as a number. |
Text area
type: 'textarea'
| Property | Type | Required | Description |
|---|---|---|---|
asyncValidation | boolean | no | Determines whether to show a loading indicator during asynchronous validation. |
onChange | (value: string) => void | no | Callback function triggered when the field value changes. Receives the current value as a string. |
Select
type: 'select'
| Property | Type | Required | Description |
|---|---|---|---|
optionsKey | string | no | A key used to retrieve options from the React Hook Form context. |
options | IOption[] | no | The options of the list. Each option is an object with label (the text shown) and value (a string or number). |
nullable | boolean | no | Determines whether the field can be empty. Defaults to false. |
multiple | boolean | no | Determines whether the user can select multiple options. Defaults to false. |
onChange | (value: StringOrNumber | StringOrNumber[]) => void | no | A callback function triggered when the field value changes. Receives the current value as a string or number (or an array of these values if multiple is true). |
To change the options depending on another field, use a condition of type options. See Conditions.
Checkbox and toggle
type: 'checkbox' and type: 'toggle' have one property of their own.
| Property | Type | Required | Description |
|---|---|---|---|
onChange | (value: boolean) => void | no | Called when the value changes. |
Radio group
type: 'radio-group' for string values, type: 'radio-group-number' for numeric values
| Property | Type | Required | Description |
|---|---|---|---|
buttons | { label: string; value: StringOrNumber }[] | yes | An array of objects, each containing:label: Text displayed next to the radio button.value: Value sent when this radio button is selected. Can be a string or number. |
onChange | (value: StringOrNumber) => void | no | Callback function triggered when the field value changes. Receives the current value as a string or number. |
Button group
type: 'button-group'
| Property | Type | Required | Description |
|---|---|---|---|
buttons | { label: string; value: StringOrNumber }[] | yes | An array of objects, each containing:label: Text displayed on the button.value: Value sent when this button is selected. Can be a string or number. |
onChange | (value: StringOrNumber) => void | no | Callback function triggered when the field value changes. Receives the current value as a string or number. |
Slider
type: 'slider'
| Property | Type | Required | Description |
|---|---|---|---|
showValue | boolean | no | Determines whether to display the current slider value. Defaults to false. |
scale | { min: number; max: number; step?: number } | yes | An object defining the slider range:min: Minimum slider value.max: Maximum slider value.step: Increment step for value changes. Defaults to 1. |
onChange | (value: number | number[]) => void | no | Callback function triggered when the slider value changes. Receives the current value as a number or an array of numbers (for range sliders). |
Date and time
type: 'date-picker' for date and time, type: 'only-date-picker' for the date, type: 'only-time-picker' for the time
| Property | Type | Required | Description |
|---|---|---|---|
ampm | boolean | no | Determines whether to use 12-hour format with AM/PM. Defaults based on locale. |
disableFuture | boolean | no | Disables selection of future dates. Defaults to false. |
disablePast | boolean | no | Disables selection of past dates. Defaults to false. |
minDate | Date | string | no | Minimum selectable date/time. Accepts a Date object or ISO string. Dates before this value will be disabled in the picker. For 'date-picker' type, both date and time are constrained. For 'only-time-picker', only the time portion is used. |
maxDate | Date | string | no | Maximum selectable date/time. Accepts a Date object or ISO string. Dates after this value will be disabled in the picker. For 'date-picker' type, both date and time are constrained. For 'only-time-picker', only the time portion is used. |
utcFormat | boolean | no | Displays date and time in UTC format. Defaults to false. |
onChange | (value: Date) => void | no | Callback triggered on value change. Receives the current value as a Date object. |
Example: a date that must lie within the year 2026.
{
name: 'inspectionDate',
type: 'only-date-picker',
label: 'Inspection date',
minDate: '2026-01-01',
maxDate: '2026-12-31'
}
Color
type: 'color'
| Property | Type | Required | Description |
|---|---|---|---|
hasLabel | boolean | no | Determines whether to display the field label. Defaults to false. |
onChange | (value: string) => void | no | Callback function triggered when the field value changes. Receives the current value as a string (hex color code). |
File
type: 'file'
| Property | Type | Required | Description |
|---|---|---|---|
accept | string | no | Comma-separated list of accepted file types (forwarded to the underlying <input type="file"> accept attribute), for example 'image/*' or '.png,.jpg'. |
downloadable | boolean | no | If true, after upload it shows an option to download the uploaded file. Defaults to false. |
withImagePreview | boolean | no | If the file is an image, determines whether to show an image preview for the uploaded file. Defaults to false. |
Label
type: 'label' shows the label text and takes no input. Its name can be any string; it does not have to be a key of the form data.
Action
type: 'action' renders a button. Its name can be any string.
| Property | Type | Required | Description |
|---|---|---|---|
onClick | (methods: UseFormReturn<FieldValues, any, undefined>) => void | yes | Called when the user clicks the button. Receives the methods of the form, for example getValues, setValue and trigger. |
icon | IconProp | yes | The Font Awesome icon on the button. Write the name, for example 'trash', or the style and the name, for example ['fal', 'trash']. See Icons. |
Select from table
type: 'select-from-table' has its own configuration in App Engine scripts. It is described in Form configuration in AppEngine. The columns of its table are defined as in Table column, filter and sort reference for App Engine.
Icons
In a script you can use every Font Awesome icon by its name. They are available without an import. A plain name such as 'user' uses the solid style. To choose another style, write the style and the name as an array:
| Style | Notation |
|---|---|
| Solid | ['fas', 'user'] |
| Regular | ['far', 'user'] |
| Light | ['fal', 'user'] |
| Duotone | ['fad', 'user'] |
| Brands | ['fab', 'github'] |
Both notations work wherever a field takes an icon, also in select-from-table fields since version 17.2.
Conditions
A condition changes a field while the user fills in the form. You name the fields to watch and return the new state from a function.
| Property | Type | Required | Description |
|---|---|---|---|
type | 'disabled' | 'hidden' | 'showRequiredAsterisk' | 'options' | yes | What the condition controls: whether the field is inactive, whether it is hidden, whether it shows the asterisk, or which options a select field offers. |
watchedValues | string[] | no | The names of the fields whose values are passed to the function. The condition is evaluated again whenever one of them changes. |
custom | (values: any[]) => boolean | yes | Receives the watched values in the order of watchedValues. Returns true or false for the first three types. For options it returns the array of options. |
A field can have one condition or an array of conditions.
{
name: 'reason',
type: 'textarea',
label: 'Reason',
condition: {
type: 'hidden',
watchedValues: ['status'],
custom: ([status]) => status !== 'rejected'
}
}
The field reason is hidden unless status is rejected.
Validation rules
Each entry of validation is an object with one or more rules and an optional message. If you do not pass your own validationSchema to the form, the rules of all fields are turned into one.
validation: [
{ required: true, message: 'Enter a name.' },
{ max: 128 }
]
Rules for every type of value:
| Rule | Type | Meaning |
|---|---|---|
required | boolean | The field must have a value. |
notRequired | boolean | The field may stay empty. |
nullable | boolean | null is accepted as a value. |
nonNullable | boolean | null is not accepted. |
oneOf | T[] | The value must be one of the listed values. |
notOneOf | T[] | The value must not be one of the listed values. |
when | { keys, is, then, otherwise } | Applies further rules depending on the value of other fields. keys names the fields, is is the value or a test function, then and otherwise receive the schema and return the changed schema. |
test | { name, message, test } | A check of your own. test receives the value and returns true if it is valid. It may return a promise. |
transform | (value, originalValue, schema) => any | Changes the value before it is validated. |
Additional rules by type of value:
| For | Rule | Type | Meaning |
|---|---|---|---|
| Text | min, max, length | number | The smallest, largest or exact number of characters. |
| Text | matches | string | A regular expression the text must match. |
| Text | email, url, uuid, datetime | boolean | The text must be an e-mail address, a URL, a UUID or a date and time in ISO notation. |
| Text | trim, lowercase, uppercase | boolean | Removes surrounding spaces or converts the text to lower or upper case. |
| Number | min, max | number | The smallest and largest value, both included. |
| Number | lessThan, moreThan | number | The value must be below or above the given number. |
| Number | positive, negative, integer | boolean | The value must be positive, negative or a whole number. |
| Number | truncate | boolean | Cuts off the decimal places. |
| Number | round | 'floor' | 'ceil' | 'round' | 'trunc' | Rounds the value in the given way. |
| Date | min, max | Date | string | The earliest and latest date. |
| List of values | min, max, length | number | The smallest, largest or exact number of selected values. |
| Yes / no | isTrue, isFalse | boolean | The value must be true or must be false. |
Sections
The fields of a form are grouped in sections. config.sections is an array of these objects:
| Property | Type | Required | Description |
|---|---|---|---|
fields | Field[] | yes | The fields of the section. |
section | string | no | The title of the section. |
showRequiredAsterisk | boolean | no | Shows an asterisk next to the title. Visual only. |
headerField | Field | no | A field shown next to the title. |
sx | SxProps | no | Custom styles for the section. |
The spacing, elevation and background of sections and of the whole form are set in ui. See Form and Table UI configuration for App Engine.