Class: Daisy::DataDisplay::AccordionComponent

Inherits:
LocoMotion::BaseComponent show all
Includes:
LocoMotion::Concerns::TippableComponent
Defined in:
app/components/daisy/data_display/accordion_component.rb

Defined Under Namespace

Classes: AccordionSectionComponent

Constant Summary

Constants inherited from LocoMotion::BaseComponent

LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS

Instance Attribute Summary collapse

Attributes inherited from LocoMotion::BaseComponent

#config, #loco_parent

Instance Method Summary collapse

Methods inherited from LocoMotion::BaseComponent

#before_render, build, #component_ref, #config_option, #cssify, define_modifier, define_modifiers, define_part, define_parts, define_size, define_sizes, #empty_part_content, #inspect, #part, register_component_initializer, register_component_setup, #rendered_css, #rendered_data, #rendered_html, #rendered_stimulus_controllers, #rendered_tag_name, renders_many, renders_one, set_component_name, #set_loco_parent, #strip_spaces

Methods included from LocoMotion::Concerns::InspectableComponent

#build_inspect_string

Constructor Details

#initialize(**kws, &block) ⇒ AccordionComponent

Creates a new accordion component.

Parameters:

  • kws (Hash)

    The keyword arguments for the component.

Options Hash (**kws):

  • name (String)

    The name attribute for all radio buttons in this accordion. Defaults to a random string.

  • modifier (Symbol)

    Optional modifier for the accordion’s appearance. Use ‘:arrow` to show arrow indicators, or `:plus` to show plus/minus indicators.

  • tip (String)

    The tooltip text to display when hovering over the component.



161
162
163
164
165
# File 'app/components/daisy/data_display/accordion_component.rb', line 161

def initialize(**kws, &block)
  super

  @name = config_option(:name, "accordion-#{SecureRandom.uuid}")
end

Instance Attribute Details

#nameString (readonly)

Returns The name attribute for all radio buttons in this accordion.

Returns:

  • (String)

    The name attribute for all radio buttons in this accordion.



144
145
146
# File 'app/components/daisy/data_display/accordion_component.rb', line 144

def name
  @name
end