Module: UI::ContextMenuLabelBehavior
- Included in:
- ContextMenuLabel, ContextMenuLabelComponent
- Defined in:
- app/behaviors/ui/context_menu_label_behavior.rb
Overview
ContextMenuLabelBehavior
Shared behavior for ContextMenuLabel component across ERB, ViewComponent, and Phlex implementations.
Instance Method Summary collapse
-
#context_menu_label_classes ⇒ Object
Returns combined CSS classes for the label.
-
#context_menu_label_data_attributes ⇒ Object
Returns data attributes for the label.
-
#context_menu_label_html_attributes ⇒ Object
Returns HTML attributes for the context menu label.
Instance Method Details
#context_menu_label_classes ⇒ Object
Returns combined CSS classes for the label
16 17 18 19 20 21 22 23 24 25 |
# File 'app/behaviors/ui/context_menu_label_behavior.rb', line 16 def classes_value = respond_to?(:classes, true) ? classes : @classes base_classes = "text-foreground px-2 py-1.5 text-sm font-medium" TailwindMerge::Merger.new.merge([ base_classes, @inset ? "pl-8" : nil, classes_value ].compact.join(" ")) end |
#context_menu_label_data_attributes ⇒ Object
Returns data attributes for the label
28 29 30 31 32 |
# File 'app/behaviors/ui/context_menu_label_behavior.rb', line 28 def { inset: @inset } end |
#context_menu_label_html_attributes ⇒ Object
Returns HTML attributes for the context menu label
8 9 10 11 12 13 |
# File 'app/behaviors/ui/context_menu_label_behavior.rb', line 8 def { class: , data: } end |