Skip to content

Form Template Element - Drop Down Single Select

Functional Behavior

Select one option from a selector styled as a dropdown menu. Only one choice is allowed.

Visual Representation

A Drop Down Selection of a single entry from the defined enum values.

Parent Elements

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

Definition

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

Parameters

The Drop Down Single Select form element takes the following parameters:

Drop Down 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: "Drop Down 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: "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 Drop Down Single Select form element, and its parents.

Example:
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "dropDownSingleSelect Example",
  "description": "An example of the dropDownSingleSelect Element, and it's parents.",
  "$defs": {
    "dropDownSingleSelect": {
      "contentMediaType": "text/plain",
      "pattern": "^[^\\n]*$",
      "type": "string"
    },
    "section": {
      "additionalProperties": false,
      "type": "object"
    }
  },
  "type": "object",
  "properties": {
    "exampleSection": {
      "$ref": "#/$defs/section",
      "properties": {
        "exampleDropDownSingleSelect": {
          "$ref": "#/$defs/dropDownSingleSelect",
          "default": "option 1",
          "description": "Drop Down Single Selector.\nChoose a value from the options presented.",
          "enum": [
            "option 1",
            "option 2",
            "option 3"
          ],
          "title": "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"
        },
        "exampleSection": {
          "$ref": "#/$defs/section",
          "properties": {
            "exampleDropDownSingleSelect": {
              "$ref": "#/$defs/dropDownSingleSelect",
              "default": "option 1",
              "description": "Drop Down Single Selector.\nChoose a value from the options presented.",
              "enum": [
                "option 1",
                "option 2",
                "option 3"
              ],
              "title": "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"
        }
      },
      "x-flatten": false,
      "x-icon": "bookmark"
    }
  },
  "additionalProperties": false
}