How to set the Default State of a Boolean to False

3 replies
Last updated: Nov 12, 2020
Is there a way to set the default state of a boolean to (false)?
Nov 11, 2020, 5:56 PM
I'm wondering this too
Nov 11, 2020, 9:06 PM
For documents you can use initial value templates ( ). For objects you can't
Nov 12, 2020, 6:18 AM
Make sure your front-end code treats a missing boolean value as false.
In GROQ you can handle missing booleans and false values equally like this 
*[_type == 'story' && featured != true]
 which would match stories where featured is false or missing (or to be fair, any other value that is not
Nov 12, 2020, 6:19 AM – 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.

Categorized in