Class: Shadcn::ContextMenuItemComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::ContextMenuItemComponent
- Defined in:
- app/components/shadcn/context_menu_item_component.rb
Overview
Context Menu Item component
Constant Summary collapse
- BASE_CLASSES =
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0"- VARIANTS =
{ default: "", destructive: "text-destructive hover:bg-destructive hover:text-destructive-foreground 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) ⇒ ContextMenuItemComponent
constructor
A new instance of ContextMenuItemComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(href: nil, variant: :default, disabled: false, inset: false, **options, &block) ⇒ ContextMenuItemComponent
Returns a new instance of ContextMenuItemComponent.
21 22 23 24 25 26 27 |
# File 'app/components/shadcn/context_menu_item_component.rb', line 21 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
29 30 31 32 |
# File 'app/components/shadcn/context_menu_item_component.rb', line 29 def call tag_name = @href ? :a : :div content_tag(tag_name, item_content, item_attributes) end |