Overview
The button group fieldtype is a multiple choice input where you only get one choice. It saves the chosen option from a preset list.
Configuring
Use the options
setting to define a list of values and labels.
seat_choice: type: button_group instructions: Choose your airline seat. Choose wisely. options: left: Left middle: Middle right: Right
You may omit the labels and just specify keys. If you use this syntax, the value and label will be identical.
options: - Left - Middle - Right
Data Structure
The chosen option is stored as a string. If you only specified values for the options
array, then the label will be saved.
seat_choice: middle
Templating
It's a string, so you can just use that value.
<p>I love sitting in the {{ seat_choice }} seat. A lot.</p>
<p>I love sitting in the {{ $seat_choice }} seat. A lot.</p>
<p>I love sitting in the middle seat. A lot.</p>
Options
clearable
Allow deselecting all options, making null
a possible value. Default: false
.
options
Sets of key/value pairs define the values and labels of the buttons.