Class: SimpleForm::Tailwind::Inputs::StringInput

Inherits:
Inputs::StringInput
  • Object
show all
Includes:
OverwriteClassWithErrorOrValidClass
Defined in:
lib/simple_form/tailwind/inputs/string_input.rb

Instance Method Summary collapse

Methods included from OverwriteClassWithErrorOrValidClass

#set_input_classes

Instance Method Details

#input(*args, &blk) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/simple_form/tailwind/inputs/string_input.rb', line 11

def input(*args, &blk)
  if has_errors?
    template.(:div, (
      super + (
        template.(
          :div,
          template.heroicon("exclamation-circle", options: { class: "h-5 w-5 text-red-500" }),
          class: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none"
        )
      )
    ), class: "mt-1 relative rounded-md shadow-sm")
  else
    template.(:div, super, class: "mt-1")
  end
end