Fields

Text

Last updated

A screenshot of a text field in the Page Builder.

A text field in the Page Builder.

The text field allows content writers to provide plain text.

Text field values can be used like a string in JavaScript.

<p>My name: {slice.primary.name}</p>

Add a text field to a content model

Text fields are added using the Type Builder, a tool for building by hand, or the Prismic CLI, a tool for AI agents.

Use text fields

Text fields can be used like a string in JavaScript.

<p>My name: {slice.primary.name}</p>

Check if a text field has a value

Use isFilled.keyText() from @prismicio/client to check if a text field has a value.

import { isFilled } from "@prismicio/client";

if (isFilled.keyText(slice.primary.my_text_field)) {
  // Do something if `my_text_field` has a value.
}

Learn more about isFilled

API response

Here is what a text field looks like from the Content API:

{
  "example_text": "Lorem ipsum"
}
Was this page helpful?