Class: ShadcnPhlexcomponents::ComboboxGroup

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(aria_id: nil, **attributes) ⇒ ComboboxGroup

Returns a new instance of ComboboxGroup.



367
368
369
370
# File 'lib/shadcn_phlexcomponents/components/combobox.rb', line 367

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

Instance Method Details

#default_attributes ⇒ Object



372
373
374
375
376
377
378
379
380
381
382
# File 'lib/shadcn_phlexcomponents/components/combobox.rb', line 372

def default_attributes
  {
    role: "group",
    aria: {
      labelledby: "#{@aria_id}-group-#{SecureRandom.hex(5)}",
    },
    data: {
      combobox_target: "group",
    },
  }
end

#view_template ⇒ Object



384
385
386
# File 'lib/shadcn_phlexcomponents/components/combobox.rb', line 384

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