Module: UI::FieldGroupBehavior
- Included in:
- FieldGroup, FieldGroupComponent
- Defined in:
- app/behaviors/ui/field_group_behavior.rb
Overview
FieldGroupBehavior
Shared behavior for FieldGroup component across ERB, ViewComponent, and Phlex implementations. FieldGroup is a layout wrapper that stacks Field components.
Instance Method Summary collapse
-
#field_group_classes ⇒ Object
Returns combined CSS classes for the field group.
-
#field_group_html_attributes ⇒ Object
Returns HTML attributes for the field group wrapper element.
Instance Method Details
#field_group_classes ⇒ Object
Returns combined CSS classes for the field group
18 19 20 21 22 23 |
# File 'app/behaviors/ui/field_group_behavior.rb', line 18 def field_group_classes classes_value = respond_to?(:classes, true) ? classes : @classes base = "group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4" TailwindMerge::Merger.new.merge([base, classes_value].compact.join(" ")) end |
#field_group_html_attributes ⇒ Object
Returns HTML attributes for the field group wrapper element
9 10 11 12 13 14 15 |
# File 'app/behaviors/ui/field_group_behavior.rb', line 9 def field_group_html_attributes attributes_value = respond_to?(:attributes, true) ? attributes : @attributes { "data-slot": "field-group", class: field_group_classes }.merge(attributes_value).compact end |