Class: ShadcnPhlexcomponents::ComboboxTriggerText

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/combobox.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(value: nil, placeholder: nil, **attributes) ⇒ ComboboxTriggerText

Returns a new instance of ComboboxTriggerText.



445
446
447
448
449
# File 'lib/shadcn_phlexcomponents/components/combobox.rb', line 445

def initialize(value: nil, placeholder: nil, **attributes)
  @value = value
  @placeholder = placeholder
  super(**attributes)
end

Instance Method Details

#default_attributesObject



451
452
453
# File 'lib/shadcn_phlexcomponents/components/combobox.rb', line 451

def default_attributes
  { data: { combobox_target: "triggerText" } }
end

#view_templateObject



455
456
457
458
459
# File 'lib/shadcn_phlexcomponents/components/combobox.rb', line 455

def view_template(&)
  span(**@attributes) do
    @value || @placeholder
  end
end