Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

How to Show a List As Radio Button?

2 replies
Last updated: Jun 24, 2020
I’m unable to show a list as
radio
buttons besides following the documentation
{
      title: "Num Cols",
      name: "cols",
      type: "array",
      of: [{ type: "string" }],
      options: {
        list: [
          { title: "One Column", value: "1" },
          { title: "Two Columns", value: "2" },
          { title: "Three Col", value: "3" }
        ],
        layout: "radio",
        direction: "horizontal"
      }
    }
Any idea what I’m doing wrong?

it still shows as checkboxes
Jun 24, 2020, 4:11 PM
try this
{
      title: "Num Cols",
      name: "cols",
      type: "string",
      options: {
        list: [
          { title: "One Column", value: "1" },
          { title: "Two Columns", value: "2" },
          { title: "Three Col", value: "3" }
        ],
        layout: "radio",
        direction: "horizontal"
      }
    }
Jun 24, 2020, 4:15 PM
❤️
Jun 24, 2020, 4:17 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?