Schema - How to Create Tags with Initial Values

5 replies
Last updated: Mar 4, 2021
Hey! How would one go about to create tags with initial values? I would like my users only to be able to choose between three tags. Do I have to do this with Category?
Mar 4, 2021, 12:13 PM
You can create a list like this:

{

title: 'Genre',

name: 'genre',

type: 'string',

options: {

list: [

{title: 'Sci-Fi', value: 'sci-fi'},

{title: 'Western', value: 'western'}

], // <-- predefined values

layout: 'radio' // <-- defaults to 'dropdown'

}

}
Mar 4, 2021, 12:17 PM
Thank you!! ๐Ÿ™‚
Mar 4, 2021, 12:21 PM
I had a reply typed out for this but forgot to hit enter haha
Mar 4, 2021, 12:22 PM
So, what
user C
said ๐Ÿ˜„
Mar 4, 2021, 12:22 PM
Haha!Thank you anyway ๐Ÿ˜‰
Mar 4, 2021, 12:22 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.