Class: ShadcnPhlexcomponents::SelectGroup

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/select.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) ⇒ SelectGroup

Returns a new instance of SelectGroup.



381
382
383
384
# File 'lib/shadcn_phlexcomponents/components/select.rb', line 381

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

Instance Method Details

#default_attributes ⇒ Object



390
391
392
393
394
395
396
397
398
399
400
# File 'lib/shadcn_phlexcomponents/components/select.rb', line 390

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

#view_template ⇒ Object



386
387
388
# File 'lib/shadcn_phlexcomponents/components/select.rb', line 386

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