Class: UI::DropdownMenuContent

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

Overview

Content - Phlex implementation

Menu items container with animations and positioning. Uses DropdownMenuContentBehavior concern for shared styling logic.

Examples:

Basic usage

render UI::Content.new do
  render UI::Item.new { "Menu Item" }
end

Instance Method Summary collapse

Methods included from DropdownMenuContentBehavior

#dropdown_menu_content_classes, #dropdown_menu_content_data_attributes, #dropdown_menu_content_html_attributes

Constructor Details

#initialize(side_offset: 4, classes: "", **attributes) ⇒ DropdownMenuContent

Returns a new instance of DropdownMenuContent.

Parameters:

  • side_offset (Integer) (defaults to: 4) —

    Offset from trigger side

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

    Additional CSS classes to merge

  • attributes (Hash) —

    Additional HTML attributes



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

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

Instance Method Details

#view_template(&block) ⇒ Object



24
25
26
27
28
# File 'app/components/ui/dropdown_menu_content.rb', line 24

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