Plain text field

Updated

Use the plain text Collection field for text that doesn't need formatting.

The plain text field is a Collection field best used for short text blocks or a short paragraph related to a Collection item — basic text content that doesn't need special formatting like headings, inline styles, or inline media like images or video. You can also use plain text fields to filter and sort Collection lists or show specific elements using conditional visibility on Collection pages or in lists.

Multi-line plain text fields in the CMS make it easier to enter text across multiple lines to input, store and edit text that wouldn't fit in a single-line Plain text field. The text displays in the browser as plain text, wrapped in an element.

To add any inline styling (including line breaks) to CMS content, use the Rich text field instead.

Common uses
 

  • Short-form text that doesn't need any formatting
  • Names and titles
  • Team member bios
  • Product descriptions
  • Event descriptions

Note

Plain Text works great when you want to limit the amount of formatting the collaborators can do. Contrary to the rich text field, plain text doesn't allow any inline styling, so the output will remain clean.

Creating a plain text field

A plain text field can be added to a new or existing Collection. In Collection settings, click on New Field and then choose the Plain Text field.

Before saving the field, specify the Text field type. You can also set a minimum character count and/or a maximum character count that is allowed for this field. And as with any field, you can add a Help text and specify if the field is required or not.

A plain text field allows you to add a short text block or a single paragraph to a Collection item. As a designer, you can specify the type and function of a text field by setting the text field type:

  • Single-line (for shorter text)
  • Multiple-line (for longer text)

This will change how the text field is displayed in the CMS Panel and the Editor.

Displaying plain text

The plain text field can be connected to any text element.

  1. Add a text element in a Collection list or on a Collection page
  2. Check the Get text from checkbox in the Settings window that appears
  3. Connect it to the relevant plain text field from the field dropdown

You can also access these Settings by selecting the text element and either clicking on the settings icon next to the element label on the canvas or by going to the Settings panel. To remove the connection, uncheck the “Get text from” checkbox.

Filtering a Collection list using the plain text field

To filter your Collection list using a plain text field:

  1. Select the Collection list you want to filter
  2. Go to the Settings panel
  3. Add a Filter under Collection List Settings
  4. Select the relevant plain text field in the first dropdown
  5. Choose a rule in the second field
  6. Specify the value if needed
  7. Click Save

The filter rules that you can use with the plain text field and values are:

  • Equals - looks for Collection items with a plain text string equal to the value you specify for this rule
  • Does Not Equal - looks for Collection items with a plain text string that isn’t equal to the value you specify for this rule
  • Is Set - looks for Collection items that have any value set for this plain text field
  • Is Not Set - looks for Collection items that don’t have any value set for this plain text field

Note

Is Setand Is Not Set aren't available for the Name text field which is required by default, and thus is set always.

Sorting a Collection list using the plain text field

You can use plain texts to sort Collection items by name or last name or any text field:

  1. Select the Collection list you want to sort
  2. Go to the Settings panel
  3. Add a Sort order under Collection List Settings
  4. Select your plain text field in the first dropdown
  5. Choose the sort order in the second dropdown: alphabetical order (A-Z) or in reverse alphabetical order (Z-A).
  6. Click Save

Show or hide elements based on a plain text field

You can use conditionals to show or hide elements based on a plain text field, as long as the element is inside a Collection list or on a Collection page.

For example, if you have a button with button text connected to a plain text field and a link connected to a link field, you can add two conditions so the button only appears when both fields are set.

To show or hide an element based on a plain text field:

  1. Select the element to show or hide (must be inside a Collection list or on a Collection page)

  2. Go to Element settings > Visibility

  3. Click the “plus” icon

  4. Choose your plain text field

  5. Set the rule to Is set

  6. Set Visibility > Visible or Hidden

  7. Set Else > Visibility > Visible or Hidden

  8. Click off the modal or press Esc on your keyboard to save the conditional

  9. Repeat steps 3–8 to add another condition based on your link field

Note

If a field should always have a value, you can also set it as "Required" in the field's settings.