Class: UI::CommandInputComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
CommandInputBehavior
Defined in:
app/view_components/ui/command_input_component.rb

Instance Method Summary collapse

Methods included from CommandInputBehavior

#command_input_classes, #command_input_data_attributes, #command_input_html_attributes, #command_input_wrapper_classes

Constructor Details

#initialize(placeholder: "Type a command or search...", classes: "", **attributes) ⇒ CommandInputComponent

Returns a new instance of CommandInputComponent.



6
7
8
9
10
# File 'app/view_components/ui/command_input_component.rb', line 6

def initialize(placeholder: "Type a command or search...", classes: "", **attributes)
  @placeholder = placeholder
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
# File 'app/view_components/ui/command_input_component.rb', line 12

def call
  (:div, class: command_input_wrapper_classes) do
    safe_join([
      helpers.lucide_icon("search", class: "mr-2 h-4 w-4 shrink-0 opacity-50"),
      tag.input(**command_input_html_attributes.deep_merge(@attributes))
    ])
  end
end