Class: UI::MenubarComponent

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

Overview

MenubarComponent - ViewComponent implementation

Root container for menubar with Stimulus controller.

Examples:

Basic usage

render UI::MenubarComponent.new do
  render UI::MenuComponent.new { ... }
end

Instance Method Summary collapse

Methods included from MenubarBehavior

#menubar_classes, #menubar_data_attributes, #menubar_html_attributes

Constructor Details

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

Returns a new instance of MenubarComponent.



14
15
16
17
# File 'app/view_components/ui/menubar_component.rb', line 14

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

Instance Method Details

#callObject



19
20
21
22
23
# File 'app/view_components/ui/menubar_component.rb', line 19

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