Class: Shadcn::DropdownMenu::SubTrigger::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::DropdownMenu::SubTrigger::Component
- Defined in:
- app/components/shadcn/dropdown_menu/sub_trigger/component.rb
Overview
DropdownMenuSubTrigger — a menu item that opens the nested menu.
Direct Known Subclasses
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#inset ⇒ Object
readonly
Returns the value of attribute inset.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #call ⇒ Object
- #element_attributes(**defaults) ⇒ Object
-
#initialize(inset: false, disabled: false, **attributes) ⇒ Component
constructor
A new instance of Component.
Methods inherited from ApplicationViewComponent
#css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
#initialize(inset: false, disabled: false, **attributes) ⇒ Component
Returns a new instance of Component.
23 24 25 26 27 |
# File 'app/components/shadcn/dropdown_menu/sub_trigger/component.rb', line 23 def initialize(inset: false, disabled: false, **attributes) @inset = inset @disabled = disabled super(**attributes) end |
Instance Attribute Details
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
21 22 23 |
# File 'app/components/shadcn/dropdown_menu/sub_trigger/component.rb', line 21 def disabled @disabled end |
#inset ⇒ Object (readonly)
Returns the value of attribute inset.
21 22 23 |
# File 'app/components/shadcn/dropdown_menu/sub_trigger/component.rb', line 21 def inset @inset end |
Instance Method Details
#call ⇒ Object
46 47 48 |
# File 'app/components/shadcn/dropdown_menu/sub_trigger/component.rb', line 46 def call render_element(body: safe_join([ content, chevron ])) end |
#element_attributes(**defaults) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/components/shadcn/dropdown_menu/sub_trigger/component.rb', line 29 def element_attributes(**defaults) super(**{ role: "menuitem", tabindex: "-1", "aria-haspopup" => "menu", "aria-expanded" => "false", "data-state" => "closed", "data-inset" => (true if inset), "data-disabled" => (true if disabled), "data-shadcn--dropdown-menu-target" => "trigger", "data-action" => "click->shadcn--dropdown-menu#toggle " \ "keydown->shadcn--dropdown-menu#triggerKeydown " \ "pointerenter->shadcn--dropdown-menu#open " \ "pointerleave->shadcn--dropdown-menu#closeLater" }.merge(defaults)) end |