Class: PhlexKit::NavigationMenuTrigger

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/phlex_kit/navigation_menu/navigation_menu_trigger.rb

Overview

See navigation_menu.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ NavigationMenuTrigger

Returns a new instance of NavigationMenuTrigger.



4
# File 'app/components/phlex_kit/navigation_menu/navigation_menu_trigger.rb', line 4

def initialize(**attrs) = (@attrs = attrs)

Instance Method Details

#view_template(&block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'app/components/phlex_kit/navigation_menu/navigation_menu_trigger.rb', line 5

def view_template(&block)
  button(**mix({
    type: :button,
    class: "pk-navigation-menu-trigger",
    aria: { haspopup: "menu", expanded: "false" },
    data: { action: "click->phlex-kit--menubar#toggle mouseenter->phlex-kit--menubar#switch" }
  }, @attrs)) do
    block&.call
    chevron
  end
end