Class: UI::DropdownMenuSubContent

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

Overview

SubContent - Phlex implementation

Submenu items container positioned to the right of the trigger. Uses DropdownMenuSubContentBehavior concern for shared styling logic.

Examples:

Submenu content

render UI::SubContent.new do
  render UI::Item.new { "Submenu Item" }
end

Instance Method Summary collapse

Methods included from DropdownMenuSubContentBehavior

#dropdown_menu_sub_content_classes, #dropdown_menu_sub_content_data_attributes, #dropdown_menu_sub_content_html_attributes

Constructor Details

#initialize(side: "right", align: "start", classes: "", **attributes) ⇒ DropdownMenuSubContent

Returns a new instance of DropdownMenuSubContent.

Parameters:

  • side (String) (defaults to: "right")

    Side to position submenu (“right”, “left”, “top”, “bottom”)

  • align (String) (defaults to: "start")

    Alignment relative to trigger (“start”, “center”, “end”)

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



19
20
21
22
23
24
# File 'app/components/ui/dropdown_menu_sub_content.rb', line 19

def initialize(side: "right", align: "start", classes: "", **attributes)
  @side = side
  @align = align
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



26
27
28
29
30
# File 'app/components/ui/dropdown_menu_sub_content.rb', line 26

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