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 โ€“ Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?