Class: RubyUI::ComboboxInputTrigger

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_ui/combobox/combobox_input_trigger.rb

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(placeholder: "") ⇒ ComboboxInputTrigger

Returns a new instance of ComboboxInputTrigger.



5
6
7
8
# File 'lib/ruby_ui/combobox/combobox_input_trigger.rb', line 5

def initialize(placeholder: "", **)
  @placeholder = placeholder
  super(**)
end

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ruby_ui/combobox/combobox_input_trigger.rb', line 10

def view_template
  div(**attrs) do
    input(
      type: "text",
      placeholder: @placeholder,
      autocomplete: "off",
      autocorrect: "off",
      spellcheck: "false",
      class: "flex-1 border-0 px-0 bg-transparent outline-none focus:ring-0 placeholder:text-muted-foreground text-sm disabled:cursor-not-allowed",
      data: {
        ruby_ui__combobox_target: "inputTrigger",
        action: "keyup->ruby-ui--combobox#filterItems input->ruby-ui--combobox#filterItems"
      }
    )
    chevron_icon
  end
end