Text schema

Learn how to define schemas for textual values.

Text schemas describe textual values such as titles, colors, and URLs.

Text input

The input for a text schema can take the form of a text field, text area, color input, or even a select box, depending on the schema configuration.

Examples

Below are some examples of text schemas:

123
{
"type": "text"
}

Properties

Text schemas offer several properties that allow you to customize input validation and presentation, but not all of them can be used together.

The following list describes the properties of text schemas:

type
string

The type of the schema. Always text for text schemas.

minimumLength(optional)
number

The minimum length of the text.

maximumLength(optional)
number

The maximum length of the text.

Default:maximum allowed
format(optional)
string

The format the text must follow as listed below:

FormatDescription
multilineA multi-line text, displayed as a text area.
colorA hexadecimal color code, such as #ff0000 or #f00.
urlA URL as defined by the URL specification .
pattern(optional)
string

A regular expression the text must match, without delimiters and up to 100 characters. For example, ^[a-z0-9]+$ to only allow lowercase letters and numbers.

choices(optional)
object<string,Choice>

A map of possible values for the text, limited to 20 choices.

The keys are the values, and the values are the choice definitions as described below.

label(optional)
string

The label for the choice, up to 60 characters. For example, "Green" for the value "green".

Default:the choice value
description(optional)
string

The description of the choice, up to 160 characters. For example, "Croct's brand color" for the value "green".

You can use this description to provide additional information about the option. It supports basic Markdown formatting, including:

  • Bold: To make text bold, enclose it in double asterisks. For example, **Bold** displays Bold.
  • Italic: To italicize text, enclose it in single asterisks. For example, *Italic* appears as Italic.
  • Code: To display text in a monospaced font, enclose it in backticks. For example, code displays code.
  • Link: To create links, use square brackets followed by parentheses. For example, [Croct](https://croct.com) becomes Croct .
default(optional)
boolean

Whether the choice should be preselected on the user interface.

There can only be one default choice, otherwise the schema is considered invalid.

Default:false
position(optional)
integer

The order in which the choice should appear in the list, relative to other choices.

The choices are ordered as follows:

  • Choices with lower positions appear before those with higher positions.
  • Choices with the same position have no guaranteed order between them.
  • Choices with no position appear after those with a position.