Basics/Choices

Basics

Choices

A radio, select or checkboxes field offers options. Each option has a code, which is what the API receives, and a label, which is what people read.

options: [
  { code: "COFFEE", label: "Coffee" },
  { code: "BAKERY", label: "Bakery" },
],

Ask what the café mainly serves, as a radio:

{
  key: "kind",
  type: "radio",
  label: "What does it mainly serve?",
  options: [
    { code: "COFFEE", label: "Coffee" },
    { code: "BAKERY", label: "Bakery" },
    { code: "TEA", label: "Tea" },
  ],
},

Pick one and open the Payload tab: it holds "COFFEE", never the label. Short lists read best as a radio; a long one as a select.

Up nextShowing a field sometimes