🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Custom input components can enable conditional fields in Sanity.io.

3 replies
Last updated: Jun 17, 2020
Hey guys, does sanity support “out of the box” conditional based options. What I mean by that is, if you check an item, it reveals other options?
Jun 17, 2020, 11:56 AM
It unfortunately does not. However, it is definitely possible to do that with a custom input component. Some relevant links:

https://www.sanity.io/guides/how-to-make-a-custom-input-component
https://www.sanity.io/docs/custom-input-widgets
There is also this collection of components that's kinda undocumented:

https://github.com/sanity-io/sanity/tree/next/packages/%40sanity/components
They're very useful for making you custom input match the rest of the studio. The
sanity.json
file there can help you figure out what paths to use in your
import
statements to get those components.
Jun 17, 2020, 2:07 PM
Jun 17, 2020, 2:56 PM
i've used it a couple of times to good effect
Jun 17, 2020, 2:56 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?