Text type fields is the most basic input type. It's used to store alphanumeric text (usually single line). Additional validations can be added to make it conform to particular types of strings.
In the graph
Create a text field by simply creating a new field and marking the input type as Text (It's text by default).
Additional Properties
Property | Description | Possible Values |
---|---|---|
Default Value | The default value for this field when no value is provided. | Any String |
Required | Whether the value is a required field. Can be set in the Validations section |
Validations
The text field supports validations such as field length validations, email, arbitrary regex etc.
Operate On | Possible Conditions |
---|---|
Value | > , >= ,= ,<= ,< ,email ,regex |
Value Length | > , >= ,= ,<= ,< , |
Multiple validations can be chained together with
AND
operations
See Field Validations for more information on how to add validations.
In the CMS
When you publish a text field, it's available in the Content Management System as a simple text input. The user can enter any arbitrary text input matching the validations set in the graph.
In the API
In the API the output response for this field is a string
.
Sample GraphQL Request
{
movies {
title
}
}
Sample GraphQL Response
{
"data": {
"movies": [
{
"title": "Superman vs. Spiderman"
},
{
"title": "Raj's day out"
}
]
}
}