CategoryField

Subclass of UnitField and returns an array of selected CategoryChoiceValue elements in its response.

CategoryChoice elements with subchoices are only used for navigation. The only selectable CategoryChoice elements are those with no subchoices.

{
  "type": "category",
  "field_id": "genre",
  "title": "Select all genres that apply.",
  "choices": [
    {
      "label": "Hip-Hop/Rap",
      "value": "hip-hop-rap",
      "hint":
        "It consists of a stylized rhythmic music that commonly accompanies rapping, a rhythmic and rhyming speech that is chanted.",
      "subchoices": [
        { "label": "Dirty South", "value": "dirty-south" },
        { "label": "Industrial Hip Hop", "value": "industrial-hip-hop" },
        { "label": "Nerdcore", "value": "nerdcore" },
        { "label": "Rap", "value": "rap" },
      ]
    },
        {
      "label": "R&B/Soul",
      "value": "rb-soul",
      "subchoices": [
        { "label": "Disco", "value": "disco" },
        { "label": "Funk", "value": "funk" },
        { "label": "Motown", "value": "motown" },
      ]
        },
  ],
  "min_choices": 1,
  "max_choices": 5
}
ParameterTypeDefaultDescription
choices*arrayAn array of CategoryChoice elements to define the relevant choice.
min_choicesinteger1Minimum number of choices to select.
max_choicesinterer1Maximum number of choices to select. If this value is greater than 1, the form renders a checkbox. Otherwise, it renders a radio button.

Definition: CategoryChoice

ParameterTypeDefaultDescription
label*stringThe label of the choice field. This description may change among tasks within a project.
value*CategoryChoiceValueThe value of the choice field. Must be a string, number, or boolean.
hintstringundefinedThe tooltip text shown for this choice.
subchoicesarrayundefinedAn array of CategoryChoice elements to define the relevant subchoices.

Definition: CategoryChoiceValue

A value that can be either a string, number, or boolean.