Class: ShadcnPhlexcomponents::CommandGroup

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

Returns a new instance of CommandGroup.



313
314
315
316
# File 'lib/shadcn_phlexcomponents/components/command.rb', line 313

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

Instance Method Details

#default_attributesObject



322
323
324
325
326
327
328
329
330
331
332
# File 'lib/shadcn_phlexcomponents/components/command.rb', line 322

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

#view_templateObject



318
319
320
# File 'lib/shadcn_phlexcomponents/components/command.rb', line 318

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