Class: ShadcnPhlexcomponents::AccordionItem

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

Returns a new instance of AccordionItem.



49
50
51
52
# File 'lib/shadcn_phlexcomponents/components/accordion.rb', line 49

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

Instance Method Details

#default_attributes ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/shadcn_phlexcomponents/components/accordion.rb', line 54

def default_attributes
  {
    data: {
      value: @value,
      accordion_target: "item",
    },
  }
end

#view_template ⇒ Object



63
64
65
# File 'lib/shadcn_phlexcomponents/components/accordion.rb', line 63

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