A field in Builder is a piece of data on a model. For example, the built-in Page model comes with two fields, a Title and a Description. These two fields help define what a Page is. Any time you make or edit any kind of model in Builder, you have the option of editing fields or adding custom fields.
The following video shows some example custom fields on the three kinds of models in Builder: the Page, Section, and Data models.
To get the most out of this document, make sure you've integrated Pages, Sections, or Data. The following tutorials give step-by-step instructions:
Custom fields are fields that you add to a model. You can add custom fields to models you create or to an existing model, such as the built-in Page model. All kinds of Builder models accept custom fields, so you can add the fields you need to Page models, Section models, and Data models.
Examples of custom fields include data such as title, URL, name, timestamp, or any piece of data you want to define on a model. You define and specify aspects of your custom fields such as:
- Type: There are many types available in Builder. Refer to Custom field types for more detail.
- Localization: Translate fields according to region settings.
- Default value: Pre-populate the custom fields you create.
- Helper text: Give your users a helpful hint about what to enter into the field.
- Required: Make a field required or optional.
- Enum: Give users a predefined list of options.
- Hidden: Make a given field hidden when editing content.
The following video shows where to find custom fields on a model, points out the available field Types, and then shows Page and Section custom fields in the Visual Editor's Option tab.
You can add custom fields to any model in Builder by doing the following:
- Open the Model.
- Click the Edit Fields button.
- Click + New Field.
- Name the field.
- Choose a Type.
- Configure any other settings for the field and add additional fields as needed.
- Scroll to the top and click Save.
The following video shows adding a custom field called name
and date
to a model.
For Pages and Sections, the custom fields you create display in the content entry on the Options tab as in the following image.
For Data, the custom fields you create on the Data model are available in the Data entry. For example, a hypothetical Blog Author Data model has three custom fields, Name, Photo, and URL. The following video shows the custom fields on the Data model and using those fields in a Data entry for a new Blog Author.
To delete a custom field, click the x to the right of the field.
When you have custom fields on your model you can add specific values to the content and use those values however you want in your code. This example queries the Builder API to get the SEO image and a Canonical URL fields.
To interactively explore the data that is sent from the Builder API, check out the Builder API Explorer where you can query the Builder API using your actual data.
You can also filter content by using queries with your custom field values. This technique is useful if you want to retrieve content that only has a certain custom attribute. For example, you could filter for only entries that have a certain Canonical URL. For more information on how to use queries on your API calls, refer to Content API and the HTML API or in the options
object of any JS SDK.
The following table describes each Type in Builder along with an image of how each Type renders in the Builder UI.
This section covers the built-in types for models, but you can also make your own with plugins. For more information, see Making Your Own Plugins Overview.
Text is analogous to the text type in HTML. With the Text type, you can specify minimum and maximum length.
Creates a select in content entries. With a select, teammates can choose from options you provide.
Long Text accommodates multi-line text. With the Long Text type, you can specify minimum and maximum length.
The URL Type accommodates a URL, also known as a web address.
Use the File Type to specify what kind(s) of file a user may upload to a custom field.
The Number file type specifies that the value that the user enters must be a number.
The Boolean Type provides a toggle for a true/false setting.
The Rick text/HTML Type provides a rich text interface with styling options and a toggle to write directly in HTML. Click the code icon, <>
, at the upper right to toggle the HTML editor.
Use the Date Type to accept a date from the user. When the user clicks on the input, a datepicker opens
Use the Timestamp Type to accept a date from the user. When the user clicks on the input, a date picker opens with a time picker. Though the Date and Timestamp Types appear similar, prefer Timestamp querying.
Use Type Color to provide users with a color picker.
Use the List Type when for a series of items.
Use the Reference type when you have Data entries that users choose from. For example, you could have a Blog Author custom field and when you click the Choose Entry button, all Blog Author Data entries display.
Use the JavaScript type so users can provide JavaScript code snippets.
Use the Tags type for adding Tags. The field is empty by default. To add tags, type the tag you'd like and press Enter. Click the x to delete a tag.