Rendering the Boolean field

The Boolean field will add a switch for a true or false values for the content authors to pick from.

Use boolean value to determine CSS className

Here is an example of how to retrieve the value from a Boolean field which has the API ID switch.

Here we are using a boolean value to decide whether a className is one value or the other.

// Inside a React component 
render() {
  const position = ? 'right' : 'left';
  return (
        <div className={ position }>
          <h2>Text positioned by Boolean value...!</h2>

Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Get in touch with us on our Community Forum.