Class: UI::DropdownMenuSub

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

Overview

Sub - Phlex implementation

Container for submenu with relative positioning. Uses DropdownMenuSubBehavior concern for shared styling logic.

Examples:

Submenu

render UI::Sub.new do
  render UI::SubTrigger.new { "More Options" }
  render UI::SubContent.new { "Submenu items" }
end

Instance Method Summary collapse

Methods included from DropdownMenuSubBehavior

#dropdown_menu_sub_classes, #dropdown_menu_sub_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ DropdownMenuSub

Returns a new instance of DropdownMenuSub.

Parameters:

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



18
19
20
21
# File 'app/components/ui/dropdown_menu_sub.rb', line 18

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

Instance Method Details

#view_template(&block) ⇒ Object



23
24
25
26
27
# File 'app/components/ui/dropdown_menu_sub.rb', line 23

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