Class: PhlexKit::ContextMenuSeparator

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

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ ContextMenuSeparator

Returns a new instance of ContextMenuSeparator.



3
# File 'app/components/phlex_kit/context_menu/context_menu_separator.rb', line 3

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

Instance Method Details

#view_templateObject



4
5
6
7
8
9
10
11
# File 'app/components/phlex_kit/context_menu/context_menu_separator.rb', line 4

def view_template
  base = { class: "pk-context-menu-separator" }
  # Defaults only when the caller didn't supply their own — `mix` fuses,
  # and aria_key_set? covers the aria: hash spelling the flat key missed.
  base[:role] = "separator" unless attr_set?(:role)
  base[:"aria-orientation"] = "horizontal" unless aria_key_set?(:orientation)
  div(**mix(base, @attrs))
end