What Is a Field?

In this article, you'll learn what Fields are and how to use them in your Custom Types.

Fields are the most elementary unit of content of a Prismic Custom Type model. You use fields, along with Slices, to create your Custom Types. Each field is designed to hold different data types to cover all use cases.

Prismic has eighteen different field types.

Eight of those fields return a simple value in the API, like a Number (3) or a color ("#f3f3f3"). The other ten fields return a structured object in the API.

Refer to each field's documentation to learn more details about them all.

Simple fields

These are represented by simple primitive values, like numbers, booleans, strings.

In the API response, you can access them directly:

  uid: "example_document",
  // ...
  data: {
    example_date: "2020-12-10",
    example_timestamp: "2020-12-10T04:05:09+0000",
    example_color: "#c7ab5d",
    example_number: 74.5,
    example_key_text: "Example Key Text Value",
    example_select: "North",
    example_boolean: true,

Structured fields

In structured fields, the content is represented by a JSON object. These are the structured fields:

How to use fields

Field usage varies in Slice Machine and the Legacy Builder. Next, we will see how to edit the fields in each case.

Slice Machine vs. the Legacy Builder

We've improved the developer experience by providing a new tool called Slice Machine. This will eventually replace the Legacy Builder.

In Slice Machine

In each Custom Type and each Slice, you can create, edit, remove and modify fields using the +Add a new field button.

List of available Fields

Click on a Field to add it. Then, enter an API ID and click Add. Click the pencil button to edit the name, API ID, placeholder, and any configuration settings for each Field.

Use the Mock config tab to customize data for the Slice Simulator.

Rich Text settings

In the Legacy Builder

Mock data isn’t available in the Legacy Builder

Note that the mock config option that allows you to add data to preview content fields in the Slice Simulator is only available in Slice Machine.

Create, edit, remove, and modify fields using the drag-and-drop tool in each Custom Type in the Legacy Builder.

Whenever you add a new Field to your Custom Type, a configuration window will appear on the right side of the screen where you can customize the name, API ID, placeholder, and any particular configuration settings for each Field.

Drag and drop Fields

The JSON editor

You can add custom labels to Rich Text fields from its JSON structure. Next, we will see how you can do this in each case.

In Slice Machine

Each Slice has an individual folder within your project code. Inside this folder, there is a model.json file. You can add custom labels to the Rich Text fields there.

Edit the model.json file with caution

Only use the model.json to make changes to the Rich Text field labels. Making abrupt changes that can be done from the Slice Machine interface can cause conflicts when synchronizing changes with your repository.

In the Legacy editor

Each Custom Type has a JSON editor tab where you can edit the custom labels of the Rich Text fields.

The JSON editor tab in the Custom Type editor allows you to add advanced configurations for each field. These extra configuration options are usually not available in the visual builder of a field's configuration and can only be added manually.

You can learn more about the JSON configurations in the dedicated articles for each field.

Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Spot an error in the documentation? Get in touch with us on our Community Forum or using the feedback form above.