Fields are a predefined type of content that provides structure for multiple content entries. For more, visit the Fields Concepts Documentation.
To create a field, you'll need a model first. Then from the
fields tab on the left-hand side of the Schema view, drag out any field you'd like to use.
You will be prompted to create the name of this field, which will also auto-propagate the
In the Dropdown labeled
Advanced, you will find toggles to allow or disallow:
You can easily edit a field by hovering over it and then selecting "Edit Field". In the now opening modal, you are also able to click up the
Advanced flag to set a field as required, unique or allow multiple values.
Primary Fields can be used to select which field of a model should be shown in a Relational View. The default Primary Field is always the ID field. So when you are now connecting relations in the Content View, it will look like this:
In this particular case, I won't be able to tell which author this is.
To now change the primary field, I can head back to the schema view and hover over a field. The "Set Primary" button will be greyed out if the field itself is not set to be Required. To change this please refer to the Editing Fields section.
Now if we head back to the content view, we will see that the field we now selected to be primary will be shown when connecting authors.
You can delete a field by hover over the entry in your model. A "Delete Field" button will appear, click on that and then confirm by clicking the second prompt.
Hidden fields are just about exactly the way they sound. They are fields that you can define as hidden from the UI at the point of defining the schema. Along with setting a field as required, unique, repeatable, translatable and more, you can also define a field as hidden.
The field will always be available through the generated API as that is a core tenant of the GraphQL specification, but there are many cases where it is helpful to simply hide the value from the user interface.
Two common cases for hidden fields are:
But, as with all features built into GraphCMS, we provide you the tools and how you want to use them is up to you!
Each field is its own type of content. For example,
Single Line Text will output as a string, whereas
Rich Text will output either
raw, text, html, or markdown depending on the query. You'll want to have existing knowledge on how to use or (in instances like markdown) parse these content types. Each front end technology will do them slightly different.