Class: UI::MenubarSubComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
MenubarSubBehavior
Defined in:
app/view_components/ui/menubar_sub_component.rb

Overview

SubComponent - ViewComponent implementation

Container for submenu (trigger + content).

Examples:

Basic usage

render UI::SubComponent.new do
  render UI::SubTriggerComponent.new { "Share" }
  render UI::SubContentComponent.new { ... }
end

Instance Method Summary collapse

Methods included from MenubarSubBehavior

#menubar_sub_classes, #menubar_sub_data_attributes, #menubar_sub_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ MenubarSubComponent

Returns a new instance of MenubarSubComponent.



15
16
17
18
# File 'app/view_components/ui/menubar_sub_component.rb', line 15

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#callObject



20
21
22
23
24
# File 'app/view_components/ui/menubar_sub_component.rb', line 20

def call
   :div, **menubar_sub_html_attributes.deep_merge(@attributes) do
    content
  end
end