A set of buttons where clicking one selects it. Functionally equivalent to a Radio field but with a visual button UI.
Field::buttonGroup(string $key): ButtonGroupField->options(array $options): staticAssociative value => label array.
->allowNull(bool $allow = true): staticAllow deselecting the current value. Default: false.
Stored as a string (the selected value).
{ "layout_size": "md" }Field::buttonGroup('layout_size')
->label('Size')
->options(['sm' => 'S', 'md' => 'M', 'lg' => 'L', 'xl' => 'XL'])
->default('md'),
Field::buttonGroup('text_align')
->label('Text Alignment')
->options(['left' => 'Left', 'center' => 'Center', 'right' => 'Right'])
->allowNull(),<div class="size-{{ ctrlfield_get('layout_size') }}">
...
</div>