Class: UI::DropdownMenuLabel

Inherits:
Phlex::HTML
  • Object
show all
Includes:
DropdownMenuLabelBehavior
Defined in:
app/components/ui/dropdown_menu_label.rb

Overview

Label - Phlex implementation

Label for menu sections to organize items. Uses DropdownMenuLabelBehavior concern for shared styling logic.

Examples:

Basic label

render UI::Label.new { "My Account" }

Instance Method Summary collapse

Methods included from DropdownMenuLabelBehavior

#dropdown_menu_label_classes, #dropdown_menu_label_data_attributes, #dropdown_menu_label_html_attributes

Constructor Details

#initialize(inset: false, classes: "", **attributes) ⇒ DropdownMenuLabel

Returns a new instance of DropdownMenuLabel.

Parameters:

  • inset (Boolean) (defaults to: false) —

    Whether to add left padding for alignment

  • classes (String) (defaults to: "") —

    Additional CSS classes to merge

  • attributes (Hash) —

    Additional HTML attributes



16
17
18
19
20
# File 'app/components/ui/dropdown_menu_label.rb', line 16

def initialize(inset: false, classes: "", **attributes)
  @inset = inset
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



22
23
24
25
26
# File 'app/components/ui/dropdown_menu_label.rb', line 22

def view_template(&block)
  div(**dropdown_menu_label_html_attributes.deep_merge(@attributes)) do
    yield if block_given?
  end
end