Form input components for widgets
Reference for text-input, textarea, select, checkbox, radio-group, date-picker and file-upload, the components that collect data in a widget.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Form inputs collect what the customer types or chooses. Each input writes to a state named by its name property, so you declare the state first and then use it in functions and text. Use inputs when typing the answer in chat would be slower or error-prone, such as dates and choices from a list.
Components
| Type | Collects | State value |
|---|---|---|
text-input |
A single line of text | String |
textarea |
Several lines of text | String |
select |
One choice from a dropdown | The chosen value |
checkbox |
A yes or no answer | true or false |
radio-group |
One choice shown as visible options | The chosen value |
date-picker |
A calendar date | ISO date string, such as 2026-03-14 |
file-upload |
One or more files | List of file objects, see File uploads |
Common properties
| Property | Description |
|---|---|
name |
The state that receives the value. Required. |
label |
The text above the input. |
placeholder |
Hint text shown while the input is empty. |
required |
A button with "validate": true does not run its function until this input has a value. |
onChange |
Function that runs when the value changes. event.value holds the new value. |
showIf |
A binding. The input appears only when the value is true or non-empty. |
Type-specific properties
| Property | Applies to | Description |
|---|---|---|
inputType |
text-input |
text, email, tel or number. Picks the keyboard and validation. |
rows |
textarea |
Visible height in lines. |
options |
select, radio-group |
A list of { "label": "...", "value": "..." } objects. |
min, max |
date-picker |
Earliest and latest allowed date, as ISO strings or bindings. |
Example
{
"states": { "email": "", "topic": "", "wantsCall": false },
"components": [
{ "type": "text-input", "name": "email", "label": "Email", "inputType": "email", "required": true },
{
"type": "select",
"name": "topic",
"label": "Topic",
"options": [
{ "label": "Billing", "value": "billing" },
{ "label": "Delivery", "value": "delivery" }
]
},
{ "type": "checkbox", "name": "wantsCall", "label": "Call me back" },
{ "type": "button", "label": "Send", "onClick": "submit", "validate": true }
]
}
You should see an email field, a dropdown, a checkbox and a button. When the customer selects Send, states.email, states.topic and states.wantsCall hold their answers for the submit function.
Tip: Ask for as little as you need. Every extra field lowers the number of customers who finish.
Related pages
- States explains how inputs and states connect.
- Functions shows how to send the values to an action.
- Interactive components covers the buttons that submit them.