Class: Shadcn::Sidebar::MenuSubButton::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Sidebar::MenuSubButton::Component
- Defined in:
- app/components/shadcn/sidebar/menu_sub_button/component.rb
Overview
SidebarMenuSubButton — an <a> rather than a button, because a submenu
row is a link upstream (vendor/shadcn/ui/sidebar.tsx:680).
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(size: :md, active: false, **attributes) ⇒ Component
constructor
A new instance of Component.
- #style_variants ⇒ Object
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #tag_name
Constructor Details
#initialize(size: :md, active: false, **attributes) ⇒ Component
Returns a new instance of Component.
40 41 42 43 44 |
# File 'app/components/shadcn/sidebar/menu_sub_button/component.rb', line 40 def initialize(size: :md, active: false, **attributes) @size = size&.to_sym || :md @active = active super(**attributes) end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
38 39 40 |
# File 'app/components/shadcn/sidebar/menu_sub_button/component.rb', line 38 def active @active end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
38 39 40 |
# File 'app/components/shadcn/sidebar/menu_sub_button/component.rb', line 38 def size @size end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
50 51 52 53 54 55 56 |
# File 'app/components/shadcn/sidebar/menu_sub_button/component.rb', line 50 def element_attributes(**defaults) super(**{ "data-sidebar" => "menu-sub-button", "data-size" => size, "data-active" => active.to_s }.merge(defaults)) end |
#style_variants ⇒ Object
46 47 48 |
# File 'app/components/shadcn/sidebar/menu_sub_button/component.rb', line 46 def style_variants { size: } end |