Fields
One question each. The key names the answer, the type decides the input.
A field
{
key: "seats",
type: "number",
min: 1,
label: "Seats",
}
key is the name the API uses for the answer. label is the question people read.
Labels in more than one language
A label is a plain string, or one entry per language. The form shows the person's language, then English, then any language the label has.
label: "Seats"
label: { km: "ចំនួនកៅអី", en: "Seats" }
Titles, hints, options and messages work the same way.
Types
| Type | Asks for |
|---|---|
text | a short answer; long: true for a few lines |
number | a number, with min, max and unit |
date, time | a day, or a time of day |
select, radio | one option |
checkboxes | several options |
checkbox | one tick box, true or false |
yes-no | a question that needs an answer |
checklist | a list of items to confirm |
file | an attachment |
list | rows people add, each with its own fields |
notice | text to read, no answer |
A preset can add more. The service-form preset adds address, scan, consent and account.
Your own type
When none of these asks the question the way you need, write your own: a type file and an input component. Once registered, a form uses it like any other.
{ key: "service", type: "rating", label: "How was the inspection?" }
Your own field type builds this star rating from start to finish, with a live demo.