Class: Shadcn::CommandItemComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::CommandItemComponent
- Defined in:
- app/components/shadcn/command_item_component.rb
Overview
Command Item component - individual selectable command
Constant Summary collapse
- BASE_CLASSES =
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(value: nil, disabled: false, on_select: nil, **options) ⇒ CommandItemComponent
constructor
A new instance of CommandItemComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(value: nil, disabled: false, on_select: nil, **options) ⇒ CommandItemComponent
Returns a new instance of CommandItemComponent.
16 17 18 19 20 21 |
# File 'app/components/shadcn/command_item_component.rb', line 16 def initialize(value: nil, disabled: false, on_select: nil, **) super(**) @value = value @disabled = disabled @on_select = on_select end |
Instance Method Details
#call ⇒ Object
23 24 25 |
# File 'app/components/shadcn/command_item_component.rb', line 23 def call content_tag(:div, item_content, **item_attributes) end |