Skip to content

Commit 55c6632

Browse files
committed
Added Form Triggers Info
1 parent 02005cb commit 55c6632

File tree

10 files changed

+75
-276
lines changed

10 files changed

+75
-276
lines changed

docs/resources/control-flow/user-interactivity/forms/form-triggers.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ sidebar_position: 4
1313

1414
## On Selected
1515

16-
The **On Selected** action trigger is used to perform actions when a user selects or changes a value from a widget that presents multiple options. This trigger is associated with form widgets where selection input is required, such as Dropdown, RadioButton, CheckboxGroup, ChoiceChips, and Slider.
16+
The **On Selected** action trigger is used to perform actions when a user selects or changes a value from a widget that presents multiple options. This trigger is associated with form widgets where selection input is required, such as [Dropdown](form-widgets/dropdown.md), [RadioButton](form-widgets/radiobutton.md), [CheckboxGroup](form-widgets/checkbox.md#checkboxgroup), [ChoiceChips](form-widgets/choicechips.md), and [Slider](../../../ui/widgets/built-in-widgets/slider.md).
1717

1818
:::tip[Possible use cases]
1919

20-
- **Dropdown – Shipping Method Selection:** User selects a shipping method from options like "Standard", "Express", or "Next Day". The On Selected trigger might set the app state variable shippingOption, which updates pricing or estimated delivery time dynamically.
21-
- **Slider – Show Volume Level in Snackbar:** User adjusts a Slider from 0 to 100. The On Selected trigger displays a Snackbar showing the current volume: Volume set to: [sliderValue].
22-
- **ChoiceChips – Filter Products by Category:** User taps a chip like "All", "Electronics", or "Clothing". The On Selected trigger might set an app state variable (e.g., selectedCategory) and update the product list to match the chosen category.
20+
- **Dropdown – Shipping Method Selection:** User selects a shipping method from options like "Standard", "Express", or "Next Day". Action under the *On Selected* trigger sets the app state variable `shippingOption`, which updates pricing or estimated delivery time dynamically.
21+
- **Slider – Show Volume Level in Snackbar:** User adjusts a Slider from 0 to 100. The *On Selected* trigger displays a Snackbar showing the current volume: Volume set to: [sliderValue].
22+
- **ChoiceChips – Filter Products by Category:** User taps a chip like "All", "Electronics", or "Clothing". The *On Selected* trigger might set an app state variable (e.g., `selectedCategory`) and update the product list to match the chosen category.
2323

2424
:::
2525

@@ -34,15 +34,15 @@ To use the **On Selected** trigger:
3434

3535
## On Toggled On / On Toggled Off
3636

37-
The **On Toggled On** and **On Toggled Off** action triggers are used to perform actions when a user turns a toggleable widget on or off. These triggers are supported by widgets such as Checkbox, CheckboxListTile, Switch, and SwitchListTile; any widget that represents a binary state.
37+
The **On Toggled On** and **On Toggled Off** action triggers are used to perform actions when a user turns a toggleable widget on or off. These triggers are supported by widgets such as [Checkbox](form-widgets/checkbox.md), [CheckboxListTile](form-widgets/checkbox.md#checkboxlisttile), [Switch](form-widgets/switch.md), and [SwitchListTile](form-widgets/switch.md#switchlisttile), any widget that represents a binary state.
3838

3939
These triggers are especially useful when you want to conditionally execute different actions based on whether a user enables or disables a setting, preference, or feature.
4040

4141
:::tip[Possible use cases]
4242

43-
- **Switch – Enable Dark Mode:** User toggles a Switch to enable Dark Mode. The On Toggled On trigger sets the dark mode.
44-
- **Checkbox – Agree to Terms:** User checks a Checkbox labeled “I agree to the terms and conditions.” The On Toggled On trigger enables the Submit button. If the user unchecks it, the On Toggled Off trigger disables the button again.
45-
- **CheckboxListTile – Select Notification Channels:** User checks or unchecks options like Email, SMS, or Push Notifications. Each toggle fires either On Toggled On or On Toggled Off to update selected preferences in the backend.
43+
- **Switch – Enable Dark Mode:** User toggles a Switch to enable Dark Mode. Action under the *On Toggled On* trigger sets the dark mode.
44+
- **Checkbox – Agree to Terms:** User checks a Checkbox labeled “I agree to the terms and conditions.” The *On Toggled On* trigger enables the Submit button. If the user unchecks it, the *On Toggled Off* trigger disables the button again.
45+
- **CheckboxListTile – Select Notification Channels:** User checks or unchecks options like Email, SMS, or Push Notifications. Each toggle fires either *On Toggled O*n or *On Toggled Off* to update selected preferences in the backend.
4646

4747
:::
4848

@@ -57,14 +57,14 @@ To use the **On Toggled On** or **On Toggled Off** trigger:
5757

5858
## On Change
5959

60-
The **On Change** action trigger is used to respond to real-time user input as they type or modify the contents of an input field. This trigger is supported by widgets such as **TextField** and **Pincode**.
60+
The **On Change** action trigger is used to respond to real-time user input as they type or modify the contents of an input field. This trigger is supported by widgets such as [TextField](form-widgets/text-field.md) and [Pincode](../../../ui/widgets/built-in-widgets/pincode.md).
6161

6262
It’s ideal for enabling live form validations, updating app state as the user types, or enabling/disabling UI elements based on the current input.
6363

6464
:::tip[Possible use cases]
6565

66-
- **TextField – Enable Button When Email Is Entered:** As the user types in an email TextField, the On Change trigger checks if the input is a valid email. If it is, it enables the Continue button.
67-
- **Pincode – Auto Submit When Complete:** When a user finishes entering a 6-digit code in a Pincode widget, the On Change trigger checks if the full code is entered and triggers form submission or a backend call.
66+
- **TextField – Enable Button When Email Is Entered:** As the user types in an email TextField, action under the *On Change* trigger checks if the input is a valid email. If it is, it enables the Continue button.
67+
- **Pincode – Auto Submit When Complete:** When a user finishes entering a 6-digit code in a Pincode widget, action under the *On Change* trigger checks if the full code is entered and triggers form submission or a backend call.
6868

6969
:::
7070

@@ -81,12 +81,12 @@ To use the **On Change** trigger:
8181

8282
## On Focus Change
8383

84-
The **On Focus Change** trigger fires whenever an input field gains or loses focus, like when a user taps into or out of a **TextField** or **Pincode** widget. It’s useful for providing user guidance (on focus) or performing validations.
84+
The **On Focus Change** trigger fires whenever an input field gains or loses focus, like when a user taps into or out of a [TextField](form-widgets/text-field.md) and [Pincode](../../../ui/widgets/built-in-widgets/pincode.md) widget. It’s useful for providing user guidance (on focus) or performing validations.
8585

8686
:::tip[Possible use cases]
8787

88-
- **TextField – Show Hint on Focus:** When the TextField gains focus, the On Focus Change trigger displays a helper text or tooltip with input instructions (e.g., “Enter your phone number without dashes”).
89-
- **Pincode – Validate on Exit:** When the user finishes entering the code and the Pincode widget loses focus, the On Focus Change trigger runs validation logic to check if the input is complete or valid, and displays an error if it's not..
88+
- **TextField – Show Hint on Focus:** When the TextField gains focus, action under the *On Focus Change* trigger displays a helper text or tooltip with input instructions (e.g., “Enter your phone number without dashes”).
89+
- **Pincode – Validate on Exit:** When the user finishes entering the code and the Pincode widget loses focus, action under the *On Focus Change* trigger runs validation logic to check if the input is complete or valid, and displays an error if it's not.
9090

9191
:::
9292

docs/resources/control-flow/user-interactivity/forms/form-widgets/checkbox.md

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,8 @@ Here is a simple way to do it:
7777
</div>
7878
<p></p>
7979

80-
### Trigger action on change
8180

82-
See how to [trigger an action when a selection changes](../../forms/form-triggers.md#on-selected) on this widget.
83-
84-
### Setting initial value
81+
### Setting Initial Value
8582

8683
You might want to show the checkbox with a default value, either check or uncheck. For example, showing the checked checkbox for travel insurance.
8784

@@ -116,45 +113,9 @@ To set the initial value:
116113
</div>
117114
<p></p>
118115

119-
### Saving checkbox value
120-
121-
You might want to save the checkbox's value as soon as it is checked or unchecked. For example, saving in an app state variable or Firestore document field. You can do so by adding the action on the checkbox widget.
122-
123-
The checkbox widget provides you with the following types of actions (aka callbacks), and you can choose any of them to add actions under it.
124-
125-
1. **On Toggled On**: Actions added under this will be triggered whenever the checkbox is selected/checked.
126-
2. **On Toggled Off**: Actions added under this will be triggered whenever the checkbox is unselected/unchecked.
116+
### Saving Checkbox Value
127117

128-
Here's how you do it:
129-
130-
1. Select the **Checkbox** widget, select **Actions** from the Properties panel (the right menu), and click **Open**. This will open an **Action Flow Editor** in a new popup window.
131-
2. Select **On Toggled On** or **On Toggled Off** and add an action that will update the value. (e.g., [update app state](../../../../../resources/data-representation/app-state.md#update-app-state-action), [update Firestore record](../../../../../ff-integrations/database/cloud-firestore/firestore-actions.md), etc.)
132-
133-
<div style={{
134-
position: 'relative',
135-
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
136-
height: 0,
137-
width: '100%'}}>
138-
<iframe
139-
src="https://demo.arcade.software/O8U6Xv5IbVwH9qDwVVfV?embed&show_copy_link=true"
140-
title=""
141-
style={{
142-
position: 'absolute',
143-
top: 0,
144-
left: 0,
145-
width: '100%',
146-
height: '100%',
147-
colorScheme: 'light'
148-
}}
149-
frameborder="0"
150-
loading="lazy"
151-
webkitAllowFullScreen
152-
mozAllowFullScreen
153-
allowFullScreen
154-
allow="clipboard-write">
155-
</iframe>
156-
</div>
157-
<p></p>
118+
You may want to immediately save the checkbox’s value when it is checked or unchecked. To do this, [add an action using the trigger](../../forms/form-triggers.md#on-toggled-on--on-toggled-off) that responds to changes in the widget’s selection.
158119

159120
### Customizing
160121

@@ -314,7 +275,11 @@ Here's an example of how you can use the CheckboxGroup widget in your project:
314275
</div>
315276
<p></p>
316277

317-
### Setting initial selection
278+
### Trigger Action on Change
279+
280+
See how to [trigger an action when a selection changes](../../forms/form-triggers.md#on-selected) on this widget.
281+
282+
### Setting Initial Selection
318283

319284
Sometimes you might want to display the CheckboxGroup with some options already selected. For example, selecting the topping options that are already served with Pizza itself. You can do so by setting the initial selection for the CheckboxGroup.
320285

docs/resources/control-flow/user-interactivity/forms/form-widgets/choicechips.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ To add the ChoiceChips widget to your app:
5252
</div>
5353
<p></p>
5454

55-
### Trigger action on change
55+
### Trigger Action on Change
5656

5757
See how to [trigger an action when a selection changes](../../forms/form-triggers.md#on-selected) on this widget.
5858

59-
## Select or clear all choices [Action]
59+
## Select or Clear All Choices [Action]
6060

6161
Users may need to swiftly deselect all chips or choose all available choice chips at once. You can do so by adding the **Clear All/Select All** action.
6262

@@ -68,7 +68,7 @@ Before you add this action, ensure you [**allow multiselect**](#allow-multiselec
6868

6969
You can customize the appearance and behavior of this widget using the various properties available under the properties panel.
7070

71-
### Allow multiselect
71+
### Allow Multiselect
7272

7373
You might want to allow users to select multiple choices to filter the result.
7474

@@ -165,7 +165,7 @@ To add a space between the chips, you can use the **Chip Spacing** ad **Row Spac
165165
</div>
166166
<p></p>
167167

168-
### Align chips
168+
### Align Chips
169169

170170
When you have chips in multiple rows, you can align them using the **Alignment** property. This is similar to setting main axis alignment for the Row widget.
171171

@@ -195,7 +195,7 @@ When you have chips in multiple rows, you can align them using the **Alignment**
195195
</div>
196196
<p></p>
197197

198-
### Customizing selected and unselected chip style
198+
### Customizing Selected and Unselected Chip Style
199199

200200
Various properties under the **Selected Chip Style** and **Unselected Chip Style** section allow you to customize chips to match your design. Here's how you do it:
201201

docs/resources/control-flow/user-interactivity/forms/form-widgets/dropdown.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Let's see how to add a *DropDown* widget and build an example that shows the sel
7676
</div>
7777
<p></p>
7878

79-
### Setting initial value
79+
### Setting Initial Value
8080

8181
Setting a default or initial value for the DropDown is a common requirement for many apps. It can provide a better user experience by pre-selecting the most likely option.
8282

@@ -115,7 +115,7 @@ To set an initial value:
115115
</div>
116116
<p></p>
117117

118-
### Saving DropDown value on selection change
118+
### Saving DropDown Value on Selection Change
119119

120120
You might want to save the dropdown value as soon as the selection changes. This approach is useful when you want to ensure that the user's selection is immediately saved without having to wait for them to submit the form. By doing so, you can provide a better user experience and reduce the risk of data loss in case of any interruption.
121121

@@ -127,7 +127,7 @@ You can do so by adding an action such as [update app state](../../../../../reso
127127

128128
You can customize the appearance and behavior of this widget using the various properties available under the properties panel.
129129

130-
### Showing option label
130+
### Showing Option Label
131131

132132
The dropdown widget allows you to show a label than the actual option value. By adding the option label, you can have a simple/short name or abbreviation (which is quite easy to compare and process in the backend) instead of a tricky name (e.g., Falkland Islands (the) [Malvinas]).
133133

@@ -171,7 +171,7 @@ To show option label:
171171
</div>
172172
<p></p>
173173

174-
### Searchable dropdown
174+
### Searchable Dropdown
175175

176176
The *DropDown* widget is a good choice when you have a small number of options, up to around 10-20; however, If you have more options than that, consider using a searchable dropdown.
177177

@@ -210,7 +210,7 @@ To make the dropdown widget a searchable one:
210210

211211
![Making dropdown searchable](../../imgs/making-dd-searchable.png)
212212

213-
### Disable dropdown
213+
### Disable Dropdown
214214

215215
You might need to disable a dropdown when certain conditions are not yet met or need to be fulfilled. For example, when the dropdown options are dependent on other fields, and those fields are not filled yet.
216216

@@ -247,7 +247,7 @@ To disable the dropdown:
247247

248248
![Disabling dropdown](../../imgs/disabling-dropdown.png)
249249

250-
### Allow multi select
250+
### Allow Multi Select
251251

252252
You might want to allow users to select multiple options from the dropdown list. For example, on an e-commerce app, users might want to filter products based on multiple attributes, such as t-shirts in both 'blue' and 'red' colors.
253253

@@ -283,12 +283,11 @@ To clear the selection, you can use the [Reset Form Fields](../form-actions/rese
283283
</div>
284284
<p></p>
285285

286-
287-
### Changing dropdown size
286+
### Changing Dropdown Size
288287

289288
To change the height and width of the dropdown, select the **DropDown** widget, move to the **Properties Panel > DropDown Properties > enter the Width and Height value**.
290289

291-
### Set max height
290+
### Set Max Height
292291

293292
If needed, you can also control the dropdown height using the **Max Height** property.
294293

@@ -318,7 +317,7 @@ If needed, you can also control the dropdown height using the **Max Height** pro
318317
</div>
319318
<p></p>
320319

321-
### Adding margin
320+
### Adding Margin
322321

323322
Margin adds a space between the DropDown's text and its border. To change the margin, select the **DropDown** widget, move to the **Properties Panel > DropDown Properties >** find the **Margin** property, and change the values.
324323

@@ -348,13 +347,13 @@ Margin adds a space between the DropDown's text and its border. To change the ma
348347
</div>
349348
<p></p>
350349

351-
### Changing background color
350+
### Changing Background Color
352351

353352
To change the background color, move to the **Properties Panel > DropDown Style > set the Fill Color**.
354353

355354
![Changing background color](../../imgs/changing-background-color.png)
356355

357-
### Changing menu elevation
356+
### Changing Menu Elevation
358357

359358
Menu elevation adds a shadow to the dropdown, giving it a sense of depth and making it appear above the surface it is placed on.
360359

@@ -364,11 +363,11 @@ To change the menu elevation (depth or Z-axis), move the **Properties Panel >**
364363
The higher value draws the bigger size of the shadow.
365364
:::
366365

367-
### Adding border
366+
### Adding Border
368367

369368
See how to [add a border](../../../../ui/widgets/widget-commonalities.md#adding-border).
370369

371-
### Show/hide underline
370+
### Show/hide Underline
372371

373372
To show or hide the dropdown underline, move the **Properties Panel >** **DropDown Style** > use the **Hides Underline** toggle.
374373

@@ -398,12 +397,8 @@ To show or hide the dropdown underline, move the **Properties Panel >** **DropDo
398397
</div>
399398
<p></p>
400399

401-
### Fix position
400+
### Fix Position
402401

403402
By default, the dropdown options are displayed over/above the dropdown button. To display beneath/below the button, move the **Properties Panel >** **DropDown Style** > switch on the **Fix Position** toggle.
404403

405404
![Fix position for dropdown options](../../imgs/fix-position.webp)
406-
407-
:::info[Trigger action on change]
408-
See how to [**trigger an action when a selection changes**](../../../../ui/widgets/widget-commonalities.md#trigger-action-on-selection-change) on this widget.
409-
:::

docs/resources/control-flow/user-interactivity/forms/form-widgets/radiobutton.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The RadioButton widget adds a single option named **Option 1** by default.
5454
</div>
5555
<p></p>
5656

57-
### Trigger action on change
57+
### Trigger Action on Change
5858

5959
See how to [trigger an action when a selection changes](../../forms/form-triggers.md#on-selected) on this widget.
6060

docs/resources/control-flow/user-interactivity/forms/form-widgets/switch.md

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Here is a simple way to do it:
7474
</div>
7575
<p></p>
7676

77-
### Setting initial value
77+
### Setting Initial Value
7878

7979
You might want to show the switch with a default status, i.e., ON or OFF. For example, showing the location service setting with a default switch OFF.
8080

@@ -109,45 +109,9 @@ To set the initial value:
109109
</div>
110110
<p></p>
111111

112-
### Saving switch value
112+
### Saving Switch Value
113113

114-
You might want to save the switch value as soon as it is toggled ON or OFF. For example, saving in an app state variable or Firestore document field. You can do so by adding the action on the switch widget.
115-
116-
The switch widget provides you with the following types of actions (aka callbacks), which you can use to add actions under it.
117-
118-
1. **On Toggled On**: Actions added under this will be triggered whenever the switch is ON.
119-
2. **On Toggled Off**: Actions added under this will be triggered whenever the switch is OFF.
120-
121-
Here's how you do it:
122-
123-
1. Select the **Switch** widget, select **Actions** from the Properties panel (the right menu), and click **Open**. This will open an **Action Flow Editor** in a new popup window.
124-
2. Select **On Toggled On** or **On Toggled Off** and add an action that will update the value. (e.g., [update app state](../..//../../data-representation/app-state.md#update-app-state-action), [update Firestore record](../../../../../ff-integrations/database/cloud-firestore/firestore-actions.md), etc.)
125-
126-
<div style={{
127-
position: 'relative',
128-
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
129-
height: 0,
130-
width: '100%'}}>
131-
<iframe
132-
src="https://demo.arcade.software/XHgeXkbmfkV2YqbV9enj?embed&show_copy_link=true"
133-
title=""
134-
style={{
135-
position: 'absolute',
136-
top: 0,
137-
left: 0,
138-
width: '100%',
139-
height: '100%',
140-
colorScheme: 'light'
141-
}}
142-
frameborder="0"
143-
loading="lazy"
144-
webkitAllowFullScreen
145-
mozAllowFullScreen
146-
allowFullScreen
147-
allow="clipboard-write">
148-
</iframe>
149-
</div>
150-
<p></p>
114+
You may want to save the switch value as soon as it is toggled ON or OFF. To do this, [add an action using the trigger](../../forms/form-triggers.md#on-toggled-on--on-toggled-off) that responds to changes in the widget’s selection.
151115

152116
### Customizing
153117

0 commit comments

Comments
 (0)