Class: PhlexKit::DropdownMenuSeparator

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/phlex_kit/dropdown_menu/dropdown_menu_separator.rb

Overview

A horizontal divider between groups of PhlexKit::DropdownMenuItems. See dropdown_menu.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ DropdownMenuSeparator

Returns a new instance of DropdownMenuSeparator.



4
5
6
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_separator.rb', line 4

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

Instance Method Details

#view_templateObject



8
9
10
11
12
13
14
15
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_separator.rb', line 8

def view_template
  base = { class: "pk-dropdown-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