diff --git a/docs/3.0/fields/boolean_group.md b/docs/3.0/fields/boolean_group.md index aea8c60b..a7bcae8e 100644 --- a/docs/3.0/fields/boolean_group.md +++ b/docs/3.0/fields/boolean_group.md @@ -30,6 +30,26 @@ field :roles, as: :boolean_group, name: 'User roles', options: { admin: 'Adminis warning: :warning } ``` + +#### Computed options + +You may want to compute the values on the fly for your `BooleanGroup` field. You can use a lambda for that where you have access to the `record`, `resource`, `view`, and `field` properties where you can pull data off. + +```ruby{5-7} +# app/avo/resources/project.rb +class Avo::Resources::Project < Avo::BaseResource + field :features, + as: :boolean_group, + options: -> do + record.features.each_with_object({}) do |feature, hash| + hash[feature.id] = feature.name.humanize + end + end +end +``` + +The output value must be a hash as described above. + ::: ## Example DB payload