Module: UI::ButtonGroupSeparatorBehavior

Defined in:
app/behaviors/ui/button_group_separator_behavior.rb

Overview

SeparatorBehavior

Shared behavior for ButtonGroupSeparator 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

Instance Method Details

#separator_html_attributesObject

Returns HTML attributes for the separator element



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/behaviors/ui/button_group_separator_behavior.rb', line 11

def separator_html_attributes
  # Get Separator component attributes and merge with button group specific classes
  base_attrs = if defined?(super)
    super
  else
    {
      class: "",
      data: {
        slot: "button-group-separator",
        orientation: @orientation
      }
    }
  end

  # Merge button group specific classes
  base_attrs[:class] = TailwindMerge::Merger.new.merge([
    base_attrs[:class],
    "bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto"
  ].compact.join(" "))

  base_attrs
end