Module: UI::ButtonGroupBehavior
- Included in:
- ButtonGroup, ButtonGroupComponent
- Defined in:
- app/behaviors/ui/button_group_behavior.rb
Overview
ButtonGroupBehavior
Shared behavior for ButtonGroup component across ERB, ViewComponent, and Phlex implementations. This module provides consistent styling and HTML attribute generation.
Based on shadcn/ui ButtonGroup: ui.shadcn.com/docs/components/button-group
Instance Method Summary collapse
-
#button_group_classes ⇒ Object
Returns combined CSS classes for the button group.
-
#button_group_html_attributes ⇒ Object
Returns HTML attributes for the button group container.
Instance Method Details
#button_group_classes ⇒ Object
Returns combined CSS classes for the button group
23 24 25 26 27 28 29 30 |
# File 'app/behaviors/ui/button_group_behavior.rb', line 23 def classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ , , classes_value ].compact.join(" ")) end |
#button_group_html_attributes ⇒ Object
Returns HTML attributes for the button group container
11 12 13 14 15 16 17 18 19 20 |
# File 'app/behaviors/ui/button_group_behavior.rb', line 11 def { role: "group", data: { slot: "button-group", orientation: @orientation }, class: } end |