Class: Phlexi::Menu::Component
- Inherits:
-
COMPONENT_BASE
- Object
- Phlexi::Menu::Component
- Includes:
- Field::Common::Tokens
- Defined in:
- lib/phlexi/menu/component.rb
Overview
Base menu component that other menu renderers can inherit from. Provides the core rendering logic for hierarchical menus with support for theming, icons, badges, and active state detection.
Defined Under Namespace
Constant Summary collapse
- DEFAULT_MAX_DEPTH =
Returns The default maximum nesting depth for menu items.
3
Instance Method Summary collapse
-
#initialize(menu, max_depth: default_max_depth, **options) ⇒ Component
constructor
Initializes a new menu component.
- #view_template ⇒ Object
Constructor Details
#initialize(menu, max_depth: default_max_depth, **options) ⇒ Component
Initializes a new menu component.
38 39 40 41 42 43 44 45 |
# File 'lib/phlexi/menu/component.rb', line 38 def initialize(, max_depth: default_max_depth, **) raise ArgumentError, "Menu cannot be nil" if .nil? = @max_depth = max_depth = super() end |
Instance Method Details
#view_template ⇒ Object
47 48 49 |
# File 'lib/phlexi/menu/component.rb', line 47 def view_template nav(class: themed(:nav)) { render_items(.items) } end |