Class: UI::ContextMenuLabel

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

Overview

Label - Phlex implementation

Non-interactive label for grouping menu items. Uses ContextMenuLabelBehavior concern for shared styling logic.

Examples:

Basic usage

render UI::Label.new { "Group Label" }

Instance Method Summary collapse

Methods included from ContextMenuLabelBehavior

#context_menu_label_classes, #context_menu_label_data_attributes, #context_menu_label_html_attributes

Constructor Details

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

Returns a new instance of ContextMenuLabel.

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/context_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/context_menu_label.rb', line 22

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