Skip to content

Form Template Element - Single Line Text Entry

Functional Behavior

A single line plain text entry field. Special characters are allowed. Line breaks, and Special formatted markup, such as Markdown are not allowed.

Visual Representation

A Text entry box that allows a single line of plain text up to the maximum number of allowed characters.

Parent Elements

The Single Line Text Entry form element, can appear as a child of:

Definition

Definition: Single Line Text Entry
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "singleLineTextEntry": {
      "contentMediaType": "text/plain",
      "pattern": "^[^\\n]*$",
      "type": "string"
    }
  }
}

Parameters

The Single Line Text Entry form element takes the following parameters:

Single Line Text Entry
Parameters
default
The value given if nothing is entered.
Required optional
Type string
Example default: "Rocket"
description
The description of the field presented to the user during data entry.
Required optional
Type string
Content Media Type text/markdown; template=handlebars
Example description: "Whats your first name."
maxLength
Maximum number of characters allowed in the field.
Required yes
Type integer
Example maxLength: 300
minLength
Minimum number of characters allowed in the field.
Required optional
Type integer
Example minLength: 2
title
The label attached to the field.
Required yes
Type string
Content Media Type text/plain
Example title: "First Name"
x-guidance
Long form Markdown formatted description to give guidance about how the field is to be completed.
Required optional
Type string
Content Media Type text/markdown; template=handlebars
Example x-guidance: "Its the thing your parents called you."
x-icon
The name of the Icon to display with the field.
Required optional
Type string
Choices Icons
Example x-icon: "user"
x-placeholder
Placeholder text to display inside the field if it is empty. Unlike default it does not provide a default value for the field.
Required optional
Type string
Example x-placeholder: "???"

Example Usage

This is an Example Form Template showing just the Single Line Text Entry form element, and its parents.

Example:
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "singleLineTextEntry Example",
  "description": "An example of the singleLineTextEntry Element, and it's parents.",
  "$defs": {
    "section": {
      "additionalProperties": false,
      "type": "object"
    },
    "singleLineTextEntry": {
      "contentMediaType": "text/plain",
      "pattern": "^[^\\n]*$",
      "type": "string"
    }
  },
  "type": "object",
  "properties": {
    "exampleSection": {
      "$ref": "#/$defs/section",
      "properties": {
        "exampleSection": {
          "$ref": "#/$defs/section",
          "properties": {
            "exampleSingleLineTextEntry": {
              "$ref": "#/$defs/singleLineTextEntry",
              "default": "Rocket",
              "description": "Whats your first name.",
              "maxLength": 300,
              "minLength": 2,
              "title": "First Name",
              "x-guidance": "Its the thing your parents called you.",
              "x-icon": "user",
              "x-placeholder": "???"
            }
          },
          "x-flatten": false,
          "x-icon": "bookmark"
        },
        "exampleSingleLineTextEntry": {
          "$ref": "#/$defs/singleLineTextEntry",
          "default": "Rocket",
          "description": "Whats your first name.",
          "maxLength": 300,
          "minLength": 2,
          "title": "First Name",
          "x-guidance": "Its the thing your parents called you.",
          "x-icon": "user",
          "x-placeholder": "???"
        }
      },
      "x-flatten": false,
      "x-icon": "bookmark"
    }
  },
  "additionalProperties": false
}