Widgets in Forms
This is the official documentation of the @forestadmin/agent
Node.js agent.
Field Widgets empower your Actions Forms providing various options to display inputs and ease operators in their daily operations.
Widgets
null
All types
@forestadmin/agent@*
Use the default widget
String
@forestadmin/agent@1.34.0
Display a text input with address autocomplete.
Boolean
@forestadmin/agent@1.18.0
Display a checkbox with true/false and possibly null values.
StringList
, NumberList
@forestadmin/agent@1.24.0
Display a group of checkboxes to select multiple values.
String
@forestadmin/agent@1.27.0
Display a color picker to select a color.
Number
@forestadmin/agent@1.28.0
Display a currency input.
Date
, Dateonly
, String
@forestadmin/agent@1.29.0
Display a calendar date picker
Date
, Dateonly
, Number
, String
, StringList
@forestadmin/agent@1.17.0
Users can choose between a limited set of values.
File
, FileList
@forestadmin/agent@1.35.0
Users can upload files.
Json
@forestadmin/agent@1.31.0
Display a Json editor with syntax highlighting.
Number
@forestadmin/agent@1.25.0
Display a standard number input.
NumberList
@forestadmin/agent@1.26.0
Display a standard number input to enter a list of number values.
Date
, Dateonly
, Number
, String
@forestadmin/agent@1.23.0
Group of radio buttons to choose a value from.
String
@forestadmin/agent@1.22.0
Rich text area allowing to input formatted text.
String
@forestadmin/agent@1.21.0
Multi-line text area.
String
@forestadmin/agent@1.19.0
One-line text input.
StringList
@forestadmin/agent@1.20.0
One-line text input to enter a list of string values
Time
@forestadmin/agent@1.32.0
Input for entering a time
String
, StringList
@forestadmin/agent@1.33.0
Dropdown containing the users available in the current project
Address autocomplete widget
The address autocomplete widget allows to input an address as a text value, autocompleted by the Google Maps API.
The above code will produce the following form (when empty):
And once the user starts typing:
Options
defaultValue
string
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
placeholder
string
static value only
optional
@forestadmin/agent@1.34.0
Placeholder shown in the component.
*
Checkbox widget
The checkbox widget allows to activate or deactivate a boolean value.
The above code will produce the following form:
Options
The Checkbox
widget has no specific options, but its behavior can be customized using the following already existing options on fields:
defaultValue
boolean or null
optional
@forestadmin/agent@*
Default value of the field. Define a value different from null
in combination to isRequired
to receive a not-null value even if the user did not click the widget.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
If isRequired
is set to false (default value), the checkbox widget allows users to choose between 3 states: true
, false
and null
. Setting isRequired
to true
only allows 2 states: true
and false
. In both cases the default value will be null
if not defined.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
By default, the Checkbox
widget allows 3 states:
null
true
false
To ensure having only 2 states, you need to:
set the
isRequired
option totrue
,define a value for the
defaultValue
option.
Checkbox group widget
The checkbox group widget allows to select multiple values from a list of options.
The above code will produce the following form:
Options
defaultValue
string[] or number[]
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
options
An array of values, or array of value/label pairs.
required
@forestadmin/agent@1.24.0
List of available options in the component. Supported formats:
['Good', 'Very good']
[{value: 2, label: 'Good'}, {value: 3, label: 'Very good'}]
(context) => ['Good', 'Very good']
(context) => [{value: 2, label: 'Good'}, {value: 3, label: 'Very good'}]
Color picker widget
The color picker widget allows to select a color.
The above code will produce the following form:
Options
defaultValue
string
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
enableOpacity
boolean
static value only
optional
@forestadmin/agent@1.27.0
Allow users to select a color with an opacity.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
placeholder
string
static value only
optional
@forestadmin/agent@1.27.0
Placeholder shown in the component.
quickPalette
string[]
static value only
optional
@forestadmin/agent@1.27.0
List of colors to display in the quick palette. The list can be an array of hex colors or rgba colors.
Currency input widget
The currency input widget allows to input a currency value.
The above code will produce the following form:
Options
currency
string
required
@forestadmin/agent@1.28.0
defaultValue
number
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
base
Unit
(default value) or Cent
optional
@forestadmin/agent@1.28.0
Base unit to use for the value.unitValue is expressed in the currency's base unit.centValue is expressed as a hundredth of the base unit (typically in cents).
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
min
number
optional
@forestadmin/agent@1.28.0
Minimum value allowed.
max
number
optional
@forestadmin/agent@1.28.0
Maximum value allowed.
placeholder
string
static value only
optional
@forestadmin/agent@1.28.0
Placeholder shown in the component.
step
number
optional
@forestadmin/agent@1.28.0
Step between two values.
DatePicker widget
The date picker widget allows to input a date in a form
The above code will produce the following form :
Note: using a Dateonly
field type will hide the time section from the date picker
Options
defaultValue
Date
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
format
string
optional
@forestadmin/agent@1.29.0
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
min
Date
optional
@forestadmin/agent@1.29.0
The minimum date allowed to be set in the field
max
Date
optional
@forestadmin/agent@1.29.0
The maximum date allowed to be set in the field
placeholder
string
static value only
optional
@forestadmin/agent@1.29.0
Text will be shown as placeholder if the field is empty
The dates are sent as ISO 8601 formatted strings over the network. In order to use them as Date
object in your hooks, you can parse them directly like so
Dropdown widget
The dropdown widget allows to select a value from a list of options.
The above code will produce the following form:
In this next example, we call a remote api to get a list of products and then perform a custom filter based on given fields of the json response, and return the first 25. This example uses search: 'dynamic'
dropdown widget, which provides you with the searchValue
in the callback context.
Note: when a search is performed, only the field on which it is performed will have its options recomputed.
Options
defaultValue
Coherent with Type
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
options
An array of values, or an array of value/label pairs
required
@forestadmin/agent@1.17.0
(@forestadmin/agent@1.20.1
for dynamic options)
List of available options in the component. Supported formats:
['Good', 'Very good']
[{value: 2, label: 'Good'}, {value: 3, label: 'Very good'}]
placeholder
string
static value only
optional
@forestadmin/agent@1.17.0
Placeholder shown in the component.
search
static
, dynamic
or disabled
(default)
static value only
optional
@forestadmin/agent@1.17.0
, dynamic
available from @forestadmin/agent@1.30.0
Allow users to input text to filter values displayed in the dropdown.
- disabled
: Users need to scroll to find the appropriate option.
- static
: Users can search a value by typing terms in an input. The search will be done in the browser, based on the label.
- dynamic
The search is performed on the agent side, using any custom logic needed to fetch the required options
File picker widget
The file picker allows to upload files
The above code will produce the following form:
Options
defaultValue
File or File[]
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
extensions
string[]
optional
@forestadmin/agent@1.35.0
The whitelist of file extensions allowed. If not specified, any file extension will be accepted
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
maxSizeMb
number
optional
@forestadmin/agent@1.35.0
The max file size allowed to upload. Any file size is allowed if left empty. Make sure your server will be able to handle it.
maxCount
number (positive integer)
optional
@forestadmin/agent@1.35.0
(only available if the field type is FileList
)
The max number of files allowed to be uploaded. If not specified, any number of files is allowed
JSON editor widget
The JSON editor widget display a rich editor with syntax highlighting for JSON.
The above code will produce the following form:
Options
This widget does not have any options.
Number input widget
The number input widget allows to input a number value.
The above code will produce the following form:
Options
defaultValue
number
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
min
number
optional
@forestadmin/agent@1.25.0
Minimum value allowed.
max
number
optional
@forestadmin/agent@1.25.0
Maximum value allowed.
placeholder
string
static value only
optional
@forestadmin/agent@1.25.0
Placeholder shown in the component.
step
number
optional
@forestadmin/agent@1.25.0
Step between two values.
Number input list widget
The number input list widget allows to input a list of number values.
The above code will produce the following form (once the user entered two step values):
Options
allowDuplicates
boolean
static value only
optional
@forestadmin/agent@1.26.0
Allow users to enter duplicate values.
allowEmptyValues
boolean
static value only
optional
@forestadmin/agent@1.26.0
Allow users to enter empty values.
defaultValue
number[]
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
enableReorder
boolean
static value only
optional
@forestadmin/agent@1.26.0
Allow users to reorder values.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
min
number
optional
@forestadmin/agent@1.26.0
Minimum value allowed.
max
number
optional
@forestadmin/agent@1.26.0
Maximum value allowed.
placeholder
string
static value only
optional
@forestadmin/agent@1.26.0
Placeholder shown in the component.
step
number
optional
@forestadmin/agent@1.26.0
Step between two values.
Radio group widget
The radio group widget allows to select a value from a list of options.
The above code will produce the following form:
Options
defaultValue
Coherent with Type
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
options
An array of values, or an array of value/label pairs
required
@forestadmin/agent@1.23.0
List of available options in the component. Supported formats:
['Good', 'Very good']
[{value: 2, label: 'Good'}, {value: 3, label: 'Very good'}]
(context) => ['Good', 'Very good']
(context) => [{value: 2, label: 'Good'}, {value: 3, label: 'Very good'}]
Using the options
function, you can dynamically change the list of options based on the context, which contains information about the selected records and other values in the form. More info about dynamic configuration.
Rich text widget
The rich text widget allows to input a formatted text value.
The above code will produce the following form:
Options
defaultValue
string
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
placeholder
string
static value only
optional
@forestadmin/agent@1.22.0
Placeholder shown in the component.
Text area widget
The text area widget allows to input a multiline string value.
The above code will produce the following form:
Options
defaultValue
string
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
placeholder
string
optional
@forestadmin/agent@1.21.0
Placeholder shown in the component.
rows
number
optional
@forestadmin/agent@1.21.0
Widget's height expressed as a number of rows.
Text input widget
The text input widget allows to input a string value.
The above code will produce the following form:
Options
defaultValue
string
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
placeholder
string
static value only
optional
@forestadmin/agent@1.19.0
Placeholder shown in the component.
Text input list widget
The text input list widget allows to input a list of string values.
The above code will produce the following form (once the user entered two tags):
Options
allowDuplicates
boolean
static value only
optional
@forestadmin/agent@1.20.0
Allow users to enter duplicate values.
allowEmptyValues
boolean
static value only
optional
@forestadmin/agent@1.20.0
Allow users to enter empty values.
enableReorder
boolean
static value only
optional
@forestadmin/agent@1.20.0
Allow users to reorder values.
defaultValue
string[]
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
placeholder
string
static value only
optional
@forestadmin/agent@1.20.0
Placeholder shown in the component.
Time picker widget
The time picker widget allows to select a time
The above code will produce the following form :
time picker does not support additional options
User dropdown widget
The user dropdown widget allows to input a user or list of users from the project
The above code will produce the following form (once the user has selected some users)
Options
defaultValue
string
optional
@forestadmin/agent@*
Default value when displaying the field for the first time.
description
string
optional
@forestadmin/agent@*
Description shown above the field, with additional help for users.
isReadOnly
boolean
optional
@forestadmin/agent@*
Displays a read only field.
isRequired
boolean
optional
@forestadmin/agent@*
Requires the user to input a value before validating.
label
string
static value only
required
@forestadmin/agent@*
Field's label.
placeholder
string
static value only
optional
@forestadmin/agent@1.33.0
Placeholder shown in the component.
Last updated