Class: Shadcn::Menubar::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Menubar::Component
- Defined in:
- app/components/shadcn/menubar/component.rb
Overview
Port of registry/new-york-v4/ui/menubar.tsx — the bar itself.
Each menu inside it is a shadcn--dropdown-menu, as the context menu's
submenus are: what this controller adds is the bar — one menu open at a
time, arrows moving between the triggers, and a menu already open turning
the rest into things you merely hover to reach.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#loop ⇒ Object
readonly
Returns the value of attribute loop.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(loop: true, **attributes) ⇒ Component
constructor
Radix's
loopdefaults to true here (menubar.tsx:76), unlike the dropdown's, where it is false.
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
#initialize(loop: true, **attributes) ⇒ Component
Radix's loop defaults to true here (menubar.tsx:76), unlike the
dropdown's, where it is false. A bar is a ring; a list is not.
22 23 24 25 |
# File 'app/components/shadcn/menubar/component.rb', line 22 def initialize(loop: true, **attributes) @loop = loop super(**attributes) end |
Instance Attribute Details
#loop ⇒ Object (readonly)
Returns the value of attribute loop.
18 19 20 |
# File 'app/components/shadcn/menubar/component.rb', line 18 def loop @loop end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/components/shadcn/menubar/component.rb', line 27 def element_attributes(**defaults) super(**{ role: "menubar", "data-controller" => "shadcn--menubar", "data-shadcn--menubar-loop-value" => loop }.merge(defaults)) end |