Search code examples
javascriptsanity

How to define a tokenized tag field in Sanity?


I've seen people sport beautiful tokenized tag-fields in their Sanity studios. I don't think they are using a plug-in, so what's the incantation that will turn my homely array of strings into a tokenized tag field?


Solution

  • You can use the layout option, like this:

    {
      title: "Tags",
      name: "tags",
      type: "array",
      of: [{type: "string"}],
      options: {
        layout: "tags"
      }
    }

    There was an error in the docs. This is now documented here: https://www.sanity.io/docs/schema-types/array-type#options Thank you for bringing this to our attention!