Class: PhlexKit::ContextMenuSubTrigger

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/phlex_kit/context_menu/context_menu_sub_trigger.rb

Overview

The row that opens a ContextMenuSub (trailing ▸ chevron). See context_menu.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ ContextMenuSubTrigger

Returns a new instance of ContextMenuSubTrigger.



4
# File 'app/components/phlex_kit/context_menu/context_menu_sub_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/context_menu/context_menu_sub_trigger.rb', line 5

def view_template(&block)
  div(**mix({
    class: "pk-context-menu-item pk-context-menu-sub-trigger",
    role: "menuitem",
    tabindex: "0",
    aria: { haspopup: "menu" }
  }, @attrs)) do
    block&.call
    render Icon.new(:chevron_right, size: nil, class: "pk-context-menu-sub-chevron")
  end
end