Module: UI::ButtonGroupTextBehavior

Included in:
ButtonGroupText, ButtonGroupTextComponent
Defined in:
app/behaviors/ui/button_group_text_behavior.rb

Overview

TextBehavior

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

#text_classesObject

Returns combined CSS classes for the text element



18
19
20
21
22
23
24
# File 'app/behaviors/ui/button_group_text_behavior.rb', line 18

def text_classes
  classes_value = respond_to?(:classes, true) ? classes : @classes
  TailwindMerge::Merger.new.merge([
    text_base_classes,
    classes_value
  ].compact.join(" "))
end

#text_html_attributesObject

Returns HTML attributes for the text element



11
12
13
14
15
# File 'app/behaviors/ui/button_group_text_behavior.rb', line 11

def text_html_attributes
  {
    class: text_classes
  }
end