Reputation: 450
In sanity studio schema I made some object type with one field, dependent of other. If "all" field check to true, then "date" field should be hidden or disabled.
But I don't know how to realize it. I tried to find examples, or guides in docs, but found nothing.
const dateTime = {
name: 'dateTime',
type: 'object',
fields: [
{
name: 'all',
type: 'boolean',
},
{
name: 'date',
type: 'date',
},
],
};
Upvotes: 2
Views: 4166
Reputation: 9659
The Sanity Studio doesn't currently have an out-of-the-box way of doing this. But, it could certainly be solved by creating a custom input component for that boolean field. The custom input would then typically set the fields value depending on the state of any other fields you choose to inspect.
Someone else has also requested this feature. If you want to jump in there and voice your opinion and state what you need if for, that would be very useful!
Upvotes: 5