Module: UI::SelectLabelBehavior

Included in:
SelectLabel, SelectLabelComponent
Defined in:
app/helpers/ui/select_label_behavior.rb,
app/behaviors/ui/select_label_behavior.rb

Overview

UI::SelectLabelBehavior

Shared behavior for Select group label across ERB, ViewComponent, and Phlex implementations. This module provides consistent HTML attribute generation and styling.

Instance Method Summary collapse

Instance Method Details

#select_label_classesObject

Returns combined CSS classes



20
21
22
23
24
25
26
# File 'app/helpers/ui/select_label_behavior.rb', line 20

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

#select_label_html_attributesObject

Returns HTML attributes for the select label element



9
10
11
12
13
14
15
16
17
# File 'app/helpers/ui/select_label_behavior.rb', line 9

def select_label_html_attributes
  attributes_value = respond_to?(:attributes, true) ? attributes : @attributes
  {
    class: select_label_classes,
    data: {
      slot: "select-label" # ADDED: data-slot attribute
    }
  }.merge(attributes_value || {})
end