Boolean Group API
Per-option reference for the boolean_group field. For worked examples, see the Boolean Group guide.
Options are passed to the field declaration inside def fields in an Avo resource, such as app/avo/resources/user.rb:
field :roles, as: :boolean_group, options: {admin: "Administrator"}Checkbox choices
-> options
Maps stored keys to checkbox labels. The same choices appear in the index and show popovers. A callable is evaluated when the choices are requested and must return a hash with the same structure.
field :roles,
as: :boolean_group,
options: {admin: "Administrator", writer: "Writer"}- Type:
HashmappingStringorSymbolkeys toStringlabels, orProc/ lambda returning that hash. - Default:
{}. Passingnilalso uses{}. - Context: Evaluated in an
Avo::ExecutionContext. - Locals:
record,resource,view, andfield. - Validation: No explicit type or return-value validation. The resolved value must support hash-style iteration for rendering and saving.
An empty hash renders no choices. Stored values are matched to configured keys with string/symbol equivalence. On save, checked choices become true and unchecked choices become false; stored keys not listed in options are preserved.
Unchecked choices are saved
Omitting a configured key from the submitted selection sets it to false; it does not preserve that key's previous value. Only keys outside options remain untouched.
Shared field options
The field also accepts common field options, including labels, visibility, and read-only behavior.