Key Text Field Reference

This article explains what the Key Text field is and how to configure it in the Custom Type builder.


Key Text vs. Rich Text

The Key Text field has no formatting options. It returns a string in the API response. This makes the Rich Text field more complex and configurable. To learn more about these differences, see the Rich Text documentation.

The Key Text field allows content writers to enter a text string, it does not output any HTML. This makes it different from the Rich Text field, which outputs formatted text.

The Key Text field is preferable for short, simple text inputs that will never need formatting, such as an author's name.

Screenshot of the Key Text field in the drag-and-drop editor.

The visual builder

When configuring a Key Text field, you'll see the options to set the Field name, API ID, and Field placeholder.

Slice Machine vs. Legacy Editor

Editing fields is almost identical in Slice Machine and the Legacy editor. But it is important to know that the mock config option (to add data to preview content fields in the Slice Simulator) is only available in Slice Machine.

Screenshot of the Key Text field editor.

JSON model

The following table displays the JSON keys and values of the field’s 'API response.

Edit the JSON model with caution

Only edit the JSON model to make changes to the Rich Text field labels. Making abrupt changes can cause conflicts when synchronizing changes with your documents.

type
string (required)

Value must be Text

config

object

Object for the configuration options

config.placeholder
string

A user-friendly placeholder for the field in the entry editor

config.label

string

The label that shows up for the field in the entry editor

Example JSON configuration

The following JSON defines a Key Text field with a label and placeholder:

Copy
"description": {
  "type": "Text",
  "config": {
    "label": "Product Description",
    "placeholder": "Enter the product description..."
  }
}

API response example

Here is an API response example of a Key Text field with the API ID of example_key_text:

Copy
// API response example of a Key Text field

{
  //...
  "example_key_text": "Lorem Ipsum",
}

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.