Class: UI::NavigationMenuList

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

Overview

List - Phlex implementation

Container for navigation menu items.

Examples:

Basic usage

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

Instance Method Summary collapse

Methods included from NavigationMenuListBehavior

#navigation_menu_list_classes, #navigation_menu_list_data_attributes, #navigation_menu_list_html_attributes

Constructor Details

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

Returns a new instance of NavigationMenuList.

Parameters:

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



18
19
20
21
# File 'app/components/ui/navigation_menu_list.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/navigation_menu_list.rb', line 23

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