Skip to content

Form Template Element - Single Select

Functional Behavior

Select one option from a list of items. Only one choice is allowed.

Visual Representation

A list of items from which one item can be selected.

Parent Elements

The Single Select form element, can appear as a child of:

Definition

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

Parameters

The Single Select form element takes the following parameters:

Single Select
Parameters
default
The option from the enum which is chosen by default.
This MUST be a value defined in the enum.
Required yes
Type string
Content Media Type text/plain
Example default: "option 1"
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: "Single Selector.\nChoose a value from the options presented."
enum
Sorted array of string values from which a single value can be selected. Values must be presented in the order they appear in the array. No value that is not in the array may be listed or presented. Each item in the array MUST be unique.
Required yes
Type array
Items string
Content Media Type text/plain
Example enum: ["option 1", "option 2", "option 3"]
title
The label attached to the field.
Required yes
Type string
Content Media Type text/plain
Example title: "Single Selector"
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: "It is recommended that a good choice be made.\nA bad choice could effect prospects of success.\nA good choice could improve them.\nSo make a good choice."
x-icon
The name of the Icon to display with the field.
Required optional
Type string
Choices Icons
Example x-icon: "emoji-happy"

Example Usage

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

Example:
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "singleSelect Example",
  "description": "An example of the singleSelect Element, and it's parents.",
  "$defs": {
    "section": {
      "additionalProperties": false,
      "type": "object"
    },
    "singleSelect": {
      "contentMediaType": "text/plain",
      "pattern": "^[^\\n]*$",
      "type": "string"
    }
  },
  "type": "object",
  "properties": {
    "exampleSection": {
      "$ref": "#/$defs/section",
      "properties": {
        "exampleSection": {
          "$ref": "#/$defs/section",
          "properties": {
            "exampleSingleSelect": {
              "$ref": "#/$defs/singleSelect",
              "default": "option 1",
              "description": "Single Selector.\nChoose a value from the options presented.",
              "enum": [
                "option 1",
                "option 2",
                "option 3"
              ],
              "title": "Single Selector",
              "x-guidance": "It is recommended that a good choice be made.\nA bad choice could effect prospects of success.\nA good choice could improve them.\nSo make a good choice.",
              "x-icon": "emoji-happy"
            }
          },
          "x-flatten": false,
          "x-icon": "bookmark"
        },
        "exampleSingleSelect": {
          "$ref": "#/$defs/singleSelect",
          "default": "option 1",
          "description": "Single Selector.\nChoose a value from the options presented.",
          "enum": [
            "option 1",
            "option 2",
            "option 3"
          ],
          "title": "Single Selector",
          "x-guidance": "It is recommended that a good choice be made.\nA bad choice could effect prospects of success.\nA good choice could improve them.\nSo make a good choice.",
          "x-icon": "emoji-happy"
        }
      },
      "x-flatten": false,
      "x-icon": "bookmark"
    }
  },
  "additionalProperties": false
}