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
}

Parameter

Type

Default

Description

choices*

array

An array of CategoryChoice elements to define the relevant choice.

min_choices

integer

1

Minimum number of choices to select.

max_choices

interer

1

Maximum 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

Parameter

Type

Default

Description

label*

string

The label of the choice field. This description may change among tasks within a project.

value*

CategoryChoiceValue

The value of the choice field. Must be

hint

string

undefined

The tooltip text shown for this choice.

subchoices

array

undefined

An array of CategoryChoice elements to define the relevant subchoices.

Definition: CategoryChoiceValue

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