Boolean
Renders a checkbox and returns true or false.
Renders a checkbox and returns true or false. Use for toggling visibility of elements or enabling/disabling features within a block.
Returns: true or false.
Example
---
attributes:
show_button:
type: boolean
label: Display button
default: true
---{% if show_button %}
<a href="/contact">Get in touch</a>
{% endif %}Usage
Booleans are commonly used with accordion toggles to show or hide related settings in the site builder:
---
attributes:
show_overlay:
type: boolean
label: Display overlay
default: true
overlay_color:
type: color
label: Overlay colour
default:
r: 0
g: 0
b: 0
a: 0.5
layout:
- type: tab
label: Design
elements:
- type: accordion_toggle
toggle_attribute: show_overlay
elements:
- overlay_color
---{% if show_overlay %}
<div class="overlay" style="background-color: {{ overlay_color.rgba }}"></div>
{% endif %}