Class: Shadcn::MenubarItemComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::MenubarItemComponent
- Defined in:
- app/components/shadcn/menubar_item_component.rb
Overview
Menubar Item component Individual menu item within menubar content
Constant Summary collapse
- BASE_CLASSES =
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"- VARIANTS =
{ default: "", destructive: "text-destructive focus:bg-destructive focus:text-destructive-foreground" }.freeze
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(href: nil, variant: :default, disabled: false, inset: false, **options, &block) ⇒ MenubarItemComponent
constructor
A new instance of MenubarItemComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(href: nil, variant: :default, disabled: false, inset: false, **options, &block) ⇒ MenubarItemComponent
Returns a new instance of MenubarItemComponent.
22 23 24 25 26 27 28 |
# File 'app/components/shadcn/menubar_item_component.rb', line 22 def initialize(href: nil, variant: :default, disabled: false, inset: false, **, &block) super(**, &block) @href = href @variant = variant.to_sym @disabled = disabled @inset = inset end |
Instance Method Details
#call ⇒ Object
30 31 32 33 |
# File 'app/components/shadcn/menubar_item_component.rb', line 30 def call tag_name = @href ? :a : :div content_tag(tag_name, item_content, item_attributes) end |