Interactive components for widgets
Reference for button, link, quick-replies, tabs and accordion, the widget components customers tap, with properties, events and an example.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Interactive components respond to taps. Buttons and quick replies run functions, links open an address, and tabs and accordions reveal content. Use them to turn a decision into one tap.
Components
| Type | Use it for |
|---|---|
button |
The main action of a widget, such as "Confirm booking". |
link |
Opening a page in a new tab, such as a policy or a tracking page. |
quick-replies |
A row of short options that each send a message as the customer. |
tabs |
Switching between a few groups of content. |
accordion |
Folding long content into expandable sections. |
Properties
| Property | Applies to | Description |
|---|---|---|
label |
button, link |
The visible text. |
variant |
button |
primary, secondary or danger. Default primary. |
onClick |
button |
The function to run when tapped. |
value |
button |
A value passed to the function as event.value. |
validate |
button |
When true, the function runs only if every required input has a value. |
disabled |
button |
A binding. The button is inactive while it is true. |
url |
link |
The address to open. Use https. |
options |
quick-replies |
A list of { "label": "...", "message": "..." } objects. Tapping one sends message. |
tabs |
tabs |
A list of { "label": "...", "children": [...] } objects. |
items |
accordion |
A list of { "title": "...", "children": [...] } objects. |
trackAs |
button, link, quick-replies |
A name for click tracking. |
showIf |
All | A binding. The component appears only when the value is true or non-empty. |
Example
{
"type": "stack",
"children": [
{
"type": "button",
"label": "Confirm booking",
"variant": "primary",
"onClick": "confirm",
"validate": true,
"disabled": "{{states.isLoading}}",
"trackAs": "booking_confirm"
},
{
"type": "quick-replies",
"options": [
{ "label": "Change date", "message": "I want to change the date." },
{ "label": "Talk to a person", "message": "Please connect me to a person." }
],
"trackAs": "booking_help"
},
{ "type": "link", "label": "Cancellation policy", "url": "https://www.example.com/cancel" }
]
}
You should see a primary button, two reply chips and a link. Tapping a chip sends its message into the conversation, and the agent answers it.
Tips
- Use one
primarybutton per widget. Make everything elsesecondary. - Write button labels as verbs: "Confirm booking" is clearer than "OK".
- Use
dangeronly for actions that cannot be undone, and ask for a confirmation first. - Put a quick reply for "Talk to a person" in widgets that deal with money or bookings.
Note: A
quick-repliesoption sends a plain message, so the agent treats it like anything the customer typed. If the choice should change a state first, use abuttonand a function instead.
Related pages
- Form inputs are the inputs a validated button waits for.
- Layout shows how to arrange buttons in rows and grids.