Class: ShadcnPhlexcomponents::Input

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/input.rb

Constant Summary

Constants inherited from Base

Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER

Instance Method Summary collapse

Methods inherited from Base

#before_template, #convert_collection_hash_to_struct, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child

Constructor Details

#initialize(type: :text, **attributes) ⇒ Input

Returns a new instance of Input.



21
22
23
24
# File 'lib/shadcn_phlexcomponents/components/input.rb', line 21

def initialize(type: :text, **attributes)
  @type = type
  super(**attributes)
end

Instance Method Details

#default_attributesObject



26
27
28
29
30
# File 'lib/shadcn_phlexcomponents/components/input.rb', line 26

def default_attributes
  {
    type: @type,
  }
end

#view_templateObject



32
33
34
# File 'lib/shadcn_phlexcomponents/components/input.rb', line 32

def view_template(&)
  input(**@attributes, &)
end