Class: Shadcn::DropdownMenu::SubContent::Component

Inherits:
ApplicationViewComponent show all
Defined in:
app/components/shadcn/dropdown_menu/sub_content/component.rb

Overview

DropdownMenuSubContent

Constant Summary

Constants inherited from ApplicationViewComponent

ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary

Attributes inherited from ApplicationViewComponent

#attributes

Instance Method Summary collapse

Methods inherited from ApplicationViewComponent

#css_classes, default_tag, #initialize, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name

Constructor Details

This class inherits a constructor from Shadcn::ApplicationViewComponent

Instance Method Details

#callObject



39
40
41
# File 'app/components/shadcn/dropdown_menu/sub_content/component.rb', line 39

def call
  render_element(body: safe_join([ items, content ].flatten.compact))
end

#element_attributes(**defaults) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/components/shadcn/dropdown_menu/sub_content/component.rb', line 25

def element_attributes(**defaults)
  super(**{
    role: "menu",
    tabindex: "-1",
    "aria-orientation" => "vertical",
    "data-state" => "closed",
    hidden: true,
    "data-shadcn--dropdown-menu-target" => "content",
    "data-action" => "keydown->shadcn--dropdown-menu#contentKeydown " \
                     "pointerenter->shadcn--dropdown-menu#cancelSubTimers " \
                     "pointerleave->shadcn--dropdown-menu#closeLater"
  }.merge(defaults))
end