Text Fields

THIS PAGE
In the graph
In the CMS
In the API

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

Screenshot

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

Screenshot

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"
      }
    ]
  }
}
Did you find what you were looking for?
👍
👎
What went wrong?
Need more help?We have a thriving Discordcommunity that can help you with all things Canonic. →