Skip to main content

Multi Select

The multiselect component can be used, to select multiple values, using the mui autocomplete component.

Schema

{
"name": "Movies",
"meta": {
"displayType": "multiselect",
"description": "please select movies",
"value": [],
"isDisabled": true,
"htmlProps": {
"allowDynamic": true
},
"readOnly": false,
"options": [
{
"label": "Joker",
"value": "joker"
},
{
"label": "Parasite",
"value": "parasite"
},
{
"label": " Matrix 4",
"value": "matrix4"
},
{
"label": "Wonder Woman 2",
"value": "wonderwoman2"
},
{
"label": "The Suicide Squad",
"value": "thesuicidesquad"
},
{
"label": "Tenet",
"value": "tenet"
}
],
"validation": {
"required": true
},
"displayProps": {
"allowDynamic": true
}
}
}

Example

please select movies

Form Data:
{}

Example 1: Enabled Multiselect with Initial Value

{
"name": "Movies",
"meta": {
"displayType": "multiselect",
"description": "Please select movies",
"value": ["joker", "tenet"],
"isDisabled": false,
"options": [
{
"label": "Joker",
"value": "joker"
},
{
"label": "Parasite",
"value": "parasite"
},
{
"label": "Matrix 4",
"value": "matrix4"
},
{
"label": "Wonder Woman 2",
"value": "wonderwoman2"
},
{
"label": "The Suicide Squad",
"value": "thesuicidesquad"
},
{
"label": "Tenet",
"value": "tenet"
}
],
"validation": {
"required": true
}
}
}

Example 2: Multiselect with Optional Selection

{
"name": "Movies",
"meta": {
"displayType": "multiselect",
"description": "Please select movies",
"value": [],
"isDisabled": false,
"options": [
{
"label": "Joker",
"value": "joker"
},
{
"label": "Parasite",
"value": "parasite"
},
{
"label": "Matrix 4",
"value": "matrix4"
},
{
"label": "Wonder Woman 2",
"value": "wonderwoman2"
},
{
"label": "The Suicide Squad",
"value": "thesuicidesquad"
},
{
"label": "Tenet",
"value": "tenet"
}
],
"validation": {
"required": false
}
}
}

Example 3: Disabled Multiselect without Initial Value

{
"name": "Movies",
"meta": {
"displayType": "multiselect",
"description": "Please select movies",
"value": [],
"isDisabled": true,
"options": [
{
"label": "Joker",
"value": "joker"
},
{
"label": "Parasite",
"value": "parasite"
},
{
"label": "Matrix 4",
"value": "matrix4"
},
{
"label": "Wonder Woman 2",
"value": "wonderwoman2"
},
{
"label": "The Suicide Squad",
"value": "thesuicidesquad"
},
{
"label": "Tenet",
"value": "tenet"
}
],
"validation": {
"required": true
}
}
}

Example 4: Enabled Multiselect with All Options Selected

{
"name": "Movies",
"meta": {
"displayType": "multiselect",
"description": "Please select movies",
"value": ["joker", "parasite", "matrix4", "wonderwoman2", "thesuicidesquad", "tenet"],
"isDisabled": false,
"options": [
{
"label": "Joker",
"value": "joker"
},
{
"label": "Parasite",
"value": "parasite"
},
{
"label": "Matrix 4",
"value": "matrix4"
},
{
"label": "Wonder Woman 2",
"value": "wonderwoman2"
},
{
"label": "The Suicide Squad",
"value": "thesuicidesquad"
},
{
"label": "Tenet",
"value": "tenet"
}
],
"validation": {
"required": true
}
}
}

Example 5: Multiselect with a Subset of Options and Custom Description

{
"name": "FavoriteMovies",
"meta": {
"displayType": "multiselect",
"description": "Select your favorite movies from the list.",
"value": ["parasite", "thesuicidesquad"],
"isDisabled": false,
"options": [
{
"label": "Joker",
"value": "joker"
},
{
"label": "Parasite",
"value": "parasite"
},
{
"label": "The Suicide Squad",
"value": "thesuicidesquad"
},
{
"label": "Tenet",
"value": "tenet"
}
],
"validation": {
"required": true,
"requiredDetail": {
"errorMsg": "custom message for required detail"
}
}
}
}

Field Property

NameDescriptionType
isDisabledA boolean indicating whether the multiselect control is disabled.boolean
descriptionA string providing additional information or instructions about the multiselect control.string
requiredA boolean indicating if the multiselect control is required.boolean
valueThe initial value of the multiselect control. It should be an array of selected items.array
displayNameThe display name of the multiselect control, shown as a label or header.string
nameThe unique identifier for the multiselect control instance.string
displayTypeThe type of control, which is "multiselect" in this case.string
readOnlyA readonly field is not editable and value cannot be changedboolean

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