Class: ShadcnPhlexcomponents::CommandText

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/command.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(target:, **attributes) ⇒ CommandText

Returns a new instance of CommandText.



345
346
347
348
# File 'lib/shadcn_phlexcomponents/components/command.rb', line 345

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

Instance Method Details

#default_attributesObject



350
351
352
353
354
355
# File 'lib/shadcn_phlexcomponents/components/command.rb', line 350

def default_attributes
  {
    role: "presentation",
    data: { command_target: @target },
  }
end

#view_templateObject



357
358
359
# File 'lib/shadcn_phlexcomponents/components/command.rb', line 357

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