Field Types
Headless Forms supports 8 field types. Each type applies automatic validation and type coercion when processing submissions.
Type Reference
text
General-purpose text input.
- Example values:
"Hello world","John Doe"
Email address field. Must be a valid email format.
- Example values:
"alex@example.com"
url
Full URL field. Must be a valid URL.
- Example values:
"https://example.com","https://example.com/path"
number
Numeric values (integers or decimals).
- Example values:
42,3.14,"100"
boolean
True/false toggle values.
- Accepted as true:
true,"true","1","yes","on" - Accepted as false:
false,"false","0","no","off"
date
Date values without time.
- Example values:
"2025-01-15","January 15, 2025"
datetime
Date and time values.
- Example values:
"2025-01-15T10:30:00Z","2025-01-15 10:30:00"
select
Dropdown/choice field with predefined options.
- Requires: Options configured on the field in the dashboard
- Example: If options are
["low", "medium", "high"], only those values are accepted
Required vs Optional
Each field can be marked as required or optional:
- Required fields must be present and non-empty.
- Optional fields can be omitted or set to
null.
Validation Error Format
When validation fails, the API returns a 422 response with field-level errors:
{
"message": "The email field must be a valid email address.",
"errors": {
"email": [
"The email field must be a valid email address."
]
}
}