Skip to content

Form Template Element - Radio Button 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. The selector is styled as a set of Radio Buttons.

Parent Elements

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

Definition

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

Parameters

The Radio Button Select form element takes the following parameters:

Radio Button 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: "Silence"
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: "Choose your favorite radio station."
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: ["Hot FM", "AM Stereo (but not really)", "Silence"]
title
The label attached to the field.
Required yes
Type string
Content Media Type text/plain
Example title: "Radio 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: "Video killed the radio star."
x-icon
The name of the Icon to display with the field.
Required optional
Type string
Choices Icons
Example x-icon: "bottom-rail-toggle"

Example Usage

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

Example:
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "radioButtonSelect Example",
  "description": "An example of the radioButtonSelect Element, and it's parents.",
  "$defs": {
    "radioButtonSelect": {
      "contentMediaType": "text/plain",
      "pattern": "^[^\\n]*$",
      "type": "string"
    },
    "section": {
      "additionalProperties": false,
      "type": "object"
    }
  },
  "type": "object",
  "properties": {
    "exampleSection": {
      "$ref": "#/$defs/section",
      "properties": {
        "exampleRadioButtonSelect": {
          "$ref": "#/$defs/radioButtonSelect",
          "default": "Silence",
          "description": "Choose your favorite radio station.",
          "enum": [
            "Hot FM",
            "AM Stereo (but not really)",
            "Silence"
          ],
          "title": "Radio Selector",
          "x-guidance": "Video killed the radio star.",
          "x-icon": "bottom-rail-toggle"
        },
        "exampleSection": {
          "$ref": "#/$defs/section",
          "properties": {
            "exampleRadioButtonSelect": {
              "$ref": "#/$defs/radioButtonSelect",
              "default": "Silence",
              "description": "Choose your favorite radio station.",
              "enum": [
                "Hot FM",
                "AM Stereo (but not really)",
                "Silence"
              ],
              "title": "Radio Selector",
              "x-guidance": "Video killed the radio star.",
              "x-icon": "bottom-rail-toggle"
            }
          },
          "x-flatten": false,
          "x-icon": "bookmark"
        }
      },
      "x-flatten": false,
      "x-icon": "bookmark"
    }
  },
  "additionalProperties": false
}