Button Set

The Button Set gives you a button bar to set options. It can be useful when you want to group a number of options together in a more advanced radio or checkbox (multi argument, see blow).


The Switch field is a Button Set type that sets a true or false value based on the selection.  Users may also change the labels of the switch.



idstringRequiredUnique ID identifying the field. It will be used as meta_key. Must be different from all other field IDs.
titlestringRequiredDisplays title of the option.
subtitlestringSubtitle display of the option, situated beneath the title.
descstringRequiredDescription of the option, appearing beneath the field control.
typestringRequiredValue identifying the field type. For both of Button Set and Switch field we set the value button_set
defaultString/int or arrayOptionalString/int or array value representing the default.  See ‘Default Option’ below.
colintOptionalThe proportion of columns that display field on 12 columns per row.
optionsarrayOptionalArray of key pairs representing the individual ticks.
allow_clearboolOptionalAllow to clear choice by double click. Default value is false
mutilpleboolOptionalFlag to set the field to multi-select. Default value is false

Button Set Default Options

The value of the default option will depend on whether or not the multi argument. By default, the multi argument (if have) is set to true, the default argument accepts an array of values representing the key of the option from options to set as selected.

Example Declaration