Class: Shadcn::Menubar::Menu::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Menubar::Menu::Component
- Defined in:
- app/components/shadcn/menubar/menu/component.rb
Overview
One menu in the bar: its trigger and its panel. Upstream gives it no classes (menubar.tsx:28) — it is a grouping, not a box.
A shadcn--dropdown-menu of its own, carrying the prefix so popper.js
writes the --radix-menubar-* properties the panel reads.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary
Attributes inherited from ApplicationViewComponent
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
#call ⇒ Object
33 34 35 |
# File 'app/components/shadcn/menubar/menu/component.rb', line 33 def call render_element(body: safe_join([ trigger, , content ].compact)) end |
#element_attributes(**defaults) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/components/shadcn/menubar/menu/component.rb', line 17 def element_attributes(**defaults) super(**{ style: merged_style(CONTENTS_STYLE), "data-controller" => "shadcn--dropdown-menu", "data-shadcn--dropdown-menu-prefix-value" => "menubar", "data-shadcn--menubar-target" => "menu", # Upstream's own defaults for a menubar panel (menubar.tsx:68-70): # it hangs below the bar, aligned to its trigger's left edge and # pulled back by the bar's own padding. "data-shadcn--dropdown-menu-side-value" => "bottom", "data-shadcn--dropdown-menu-align-value" => "start", "data-shadcn--dropdown-menu-side-offset-value" => 8, "data-shadcn--dropdown-menu-align-offset-value" => -4 }.merge(defaults)) end |