Fields
Text Field

Text field

Display type

  • text
  • text_field

Basic example

Schema:

{
fields
:
[
0
:
{
name
:
"name"
meta
:
{
displayName
:
"Name"
displayType
:
"text_field"
}
}
]
}

Field properties

Properties used by this field (inside meta field in schema)

NameDescriptionType
placeholderThe hint shown in the text fieldString
isReadonlyA readonly field is not editable and value cannot be changedBoolean
isDisabledShows the field as disabled.
This is also not editable and value cannot be changed
Boolean
variantContains the field variant to be used.
Allowed values: standard, filled, outlined. Default is standard.

Common field properties

These are the common properties of a field ( inside meta field)

FieldData typeDefault ValueDescription
classNameStringNonePass classname for custom styling or reference
displayNameStringNoneIt is used to display name of the field in the form
displayTypeStringNoneIt is used to determine the field type to be displayed. Read more
displayPropsObjectNoneIt is used for field layouting. Refer for details: Display props
htmlPropsObjectNoneIt is used for setting native html attributes to basic form controls like text_field, select, number, password, email etc.
Example of such attributes would be like step, min, max for displayType number
valueString
Boolean
Number
NoneIt is value of the field
typeStringNoneUsed for hidden fields and field section.
Value for hidden field: hidden.
Value for section: section
validationObjectFor field validation
dependenciesObjectDefines relationships and dependencies between various fields. Refer here for details: Dependencies
eventsObjectDefines field level events

Field with placeholder

Schema:

{
fields
:
[
0
:
{
name
:
"name"
meta
:
{
displayName
:
"Name"
displayType
:
"text_field"
placeholder
:
"Enter your name"
}
}
]
}

Readonly field

Schema:

{
fields
:
[
0
:
{
name
:
"name"
meta
:
{
displayName
:
"Name"
displayType
:
"text_field"
isReadonly
:
true
value
:
"Godzilla"
}
}
]
}

Disabled field

Schema:

{
fields
:
[
0
:
{
name
:
"name"
meta
:
{
displayName
:
"Name"
displayType
:
"text_field"
isDisabled
:
true
value
:
"Godzilla"
}
}
]
}

Required field

Click on Submit with and without value.

Schema:

{
fields
:
[
0
:
{
name
:
"name"
meta
:
{
displayName
:
"Name"
displayType
:
"text_field"
value
:
""
validation
:
{
required
:
{
…
}
}
}
}
]
}

Field with pattern

Only supports alphanumeric characters. Special characters are not supported.


Enter any special character (!@#$%^&*) and click on Submit.

Schema:

{
fields
:
[
0
:
{
name
:
"name"
meta
:
{
displayName
:
"Name"
displayType
:
"text_field"
validation
:
{
pattern
:
{
…
}
}
}
}
]
}

Validation with minimum and maximum characters

Try to enter more than 10 characters.

Schema:

{
fields
:
[
0
:
{
name
:
"name"
meta
:
{
displayName
:
"Name"
displayType
:
"text_field"
validation
:
{
min
:
5
max
:
10
}
}
}
]
}

Schema with info msg

Schema:

{
fields
:
[
0
:
{
name
:
"name"
meta
:
{
displayName
:
"Name"
displayType
:
"text_field"
validation
:
{
info
:
"Enter your first and last name"
}
}
}
]
}

Star us at github

© Copyright 2023 MuiForms