Skip to main content

Auto-Complete

The Autocomplete component provides an enhanced input field with autocomplete functionality using Material-UI's Autocomplete component. It supports single and multiple selections, custom options, and additional actions.

Schema

[
{
"name": "movies",
"meta": {
"displayType": "autocomplete",
"displayName": "Favorite movies",
"value": [],
"readOnly": true,
"placeholder": "Select movies you like",
"description": "Select the movies you like",
"config": {
"multiple": true,
"limitTags": 2
},
"validation": {
"required": true
},
"htmlProps": {
"allowDynamic": true
},
"options": [
{ "label": "The Shawshank Redemption", "value": 1994 },
{ "label": "The Godfather", "value": 1972 },
{ "label": "The Godfather: Part II", "value": 1974 },
{ "label": "The Dark Knight", "value": 2008 },
{ "label": "12 Angry Men", "value": 1957 },
{ "label": "Schindler's List", "value": 1993 },
{
"label": "The Lord of the Rings: The Return of the King",
"value": 2003
},
{ "label": "The Good, the Bad and the Ugly", "value": 1966 },
{ "label": "Fight Club", "value": 1999 },
{
"label": "The Lord of the Rings: The Fellowship of the Ring",
"value": 2001
}
]
}
}
]

Example

Select the movies you like

Form Data:
{}

props

meta object

The meta object contains properties that define the display characteristics and behavior of the section.

NameDescriptionType
nameThe unique identifier for the checkbox control instance.string
displayNameThe name to display as the section headerstring
descriptionA description text to display under the headerstring
displayPropsAdditional properties to control display settingsobject
validationValidation rules for the sectionobject
optionsThe options to display in the dropdownarray
dependenciesConditions that must be met for the section to be displayedobject
valueThe default values for the autocomplete fieldstring
isDisabledWhether the field is disabledboolean
classNameAdditional CSS class names to apply to the sectionstring
configAdditional configuration for the autocomplete fieldobject
readOnlyA readonly field is not editable and value cannot be changedboolean
htmlPropsCustom properties to apply to the componentobject

config Object

NameDescriptionType
multipleAllow users to select multiple optionsboolean
limitTagsThe maximum number of tags to allow. Defaults to 3 if not specifiedinteger

htmlProps Object

NameDescriptionType
showAddNewshow add new button as right label elementboolean
allowDynamicEnable Static or dynamic input for array inputboolean

Common Validation Properties

FieldDescription
requiredMarks a field as mandatory
patternAdds a pattern validation for the field. For email, pattern is supported by default
patternDetailContains info msg and error msg for pattern validation property
minFor Textbox fields, it is the minimum number of characters required for the field. For number fields, it is the minimum value allowed
maxFor Textbox fields, it is the maximum number of characters allowed. For number fields, it is the maximum value allowed
minDetailContains error and info msg for min validation property
maxDetailContains error and info msg for max validation property
requiredDetailContains info msgs about the required validation property

Example JSON

Autocomplete with multiple selections

[
{
"name": "movies",
"meta": {
"displayType": "autocomplete",
"displayName": "",
"value": [],
"placeholder": "Select movies you like",
"description": "Select the movies you like",
"config": {
"multiple": true,
"limitTags": 3
},
"options": [
{ "label": "The Shawshank Redemption", "value": 1994 },
{ "label": "The Godfather", "value": 1972 },
{ "label": "The Godfather: Part II", "value": 1974 },
{ "label": "The Dark Knight", "value": 2008 },
{ "label": "12 Angry Men", "value": 1957 },
{ "label": "Schindler's List", "value": 1993 },
{
"label": "The Lord of the Rings: The Return of the King",
"value": 2003
},
{ "label": "The Good, the Bad and the Ugly", "value": 1966 },
{ "label": "Fight Club", "value": 1999 },
{
"label": "The Lord of the Rings: The Fellowship of the Ring",
"value": 2001
}
]
}
}
]

Autocomplete with single selection

[
{
"name": "movies",
"meta": {
"displayType": "autocomplete",
"displayName": "",
"value": 1994,
"placeholder": "Select a movie",
"description": "Select the movie you like",
"config": {
"multiple": false
},
"options": [
{ "label": "The Shawshank Redemption", "value": 1994 },
{ "label": "The Godfather", "value": 1972 },
{ "label": "The Godfather: Part II", "value": 1974 },
{ "label": "The Dark Knight", "value": 2008 }
]
}
}
]

Autocomplete with dependencies

[
{
"name": "movies",
"meta": {
"displayType": "autocomplete",
"displayName": "",
"value": 1994,
"placeholder": "Select a movie",
"description": "Select the movie you like",
"config": {
"multiple": false
},
"options": [
{ "label": "The Shawshank Redemption", "value": 1994 },
{ "label": "The Godfather", "value": 1972 },
{ "label": "The Godfather: Part II", "value": 1974 },
{ "label": "The Dark Knight", "value": 2008 }
],
"dependencies": {
"logic": "AND",
"conditions": [
{
"field": "name",
"operator": "NOT_EMPTY"
}
]
}
}
}
]

Autocomplete with validation

[
{
"name": "movies",
"meta": {
"displayType": "autocomplete",
"displayName": "",
"value": 1994,
"placeholder": "Select a movie",
"description": "Select the movie you like",
"config": {
"multiple": false
},
"options": [
{ "label": "The Shawshank Redemption", "value": 1994 },
{ "label": "The Godfather", "value": 1972 },
{ "label": "The Godfather: Part II", "value": 1974 },
{ "label": "The Dark Knight", "value": 2008 }
],
"validation": {
"required": true,
"requiredDetail": { "errorMsg": "Movie is a required field" }
}
}
}
]

Autocomplete with disabled field

[
{
"name": "movies",
"meta": {
"displayType": "autocomplete",
"displayName": "",
"value": 1994,
"placeholder": "Select a movie",
"description": "Select the movie you like",
"config": {
"multiple": false
},
"options": [
{ "label": "The Shawshank Redemption", "value": 1994 },
{ "label": "The Godfather", "value": 1972 },
{ "label": "The Godfather: Part II", "value": 1974 },
{ "label": "The Dark Knight", "value": 2008 }
],
"isDisabled": true
}
}
]