πŸ‘€ See Sanity in action: Watch product demo now β†’

Schema - How to make a Field that lets a User Select from Defined Options

1 replies
Last updated: Oct 25, 2021
while creating schema, how can i make a field that lets user select from one of the options for example , they can select from ['car', 'bicycle', 'truck'] ?
Oct 25, 2021, 9:04 PM
You can create a list of predefined strings using
options.list
. For example:
{
  title: 'Vehicle',
  name: 'vehicle',
  type: 'string',
  options: {
    list: [
      {title: 'Car', value: 'car'},
      {title: 'Bicycle', value: 'bicycle'}
    ], // <-- predefined values
  }
}
Oct 25, 2021, 9:08 PM

Sanity.io – build remarkable experiences at scale

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

Categorized in