True or false: we now have a Boolean Fields feature Written by Edward Hewitt in Engineering on December 10,2019 In the face of overwhelming popular demand, we have finally given the people what they want and made it possible to use Boolean Fields in Prismic. OK...so this isn't the most exciting piece of news that we've ever told you about, but we know that a lot of people out there will be very happy to hear it. That's right, Boolean Fields are ready for Beta testing and can now be activated on all Prismic repositories. What are Boolean fields? It's hard for us to make this one sound complicated...it is just a field that lets you choose between true or false. But that doesn't mean that it isn't extremely useful. The Boolean data type is associated with conditional statements that, depending on whether the condition evaluates as true or false, modify actions or options. We know that a lot of Prismic users have cases where they would like to be able to choose between two Boolean values, but, up until now, they have been having to rely on workarounds like range or select fields. I know what you're thinking: 'could you give me a couple of concrete examples of how I might be able to use this feature'? Yes, yes we can. You might want to choose whether or not to activate a feature for a specific page? Or maybe you want to set a black or white mode for your site? There really are an infinite number of use cases in which you can make use of Boolean fields. How do I use them in Prismic? Select the field in your Custom type page, give it a name, and then you have the option of assigning names for the placeholder of each value to make it clearer for your content creators. If you pick a default value, this will automatically be reflected in the API response. And finally, in your writing room pick the desired value and save. Not sure that you've done it right? Here's an example of what the API response of the field will look like. "data": { "myboolean": true } It really is that simple. There's just one thing left to do Just get in touch with us via the chat button on the website if you would like Boolean Fields activated on your Prismic repo. We are always confident in a feature by the time it reaches the Beta testing phase, but user feedback and testing at this stage helps us with our feature and product development. This news may have been a bit too much for you, so make sure to take a break and sit down before you do anything like getting behind the wheel of a car or operating heavy machinery.
Related posts Prismic Image Optimization with imgix by Edward Hewitt, on August 14,2019 Finer grain control with Prismic webhooks by Edward Hewitt, on November 15,2019