Class: DaisyUI::Accordion
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- DaisyUI::Accordion
- Defined in:
- app/components/daisy_ui/data_display/accordion.rb
Overview
Renders an accordion component that allows users to show and hide content sections.
Constant Summary collapse
- INDICATORS =
i[arrow plus].freeze
- INPUT_TYPES =
i[radio checkbox].freeze
Instance Attribute Summary collapse
-
#bg_color ⇒ Object
readonly
Returns the value of attribute bg_color.
-
#border_color ⇒ Object
readonly
Returns the value of attribute border_color.
-
#indicator ⇒ Object
readonly
Returns the value of attribute indicator.
-
#input_type ⇒ Object
readonly
Returns the value of attribute input_type.
-
#join ⇒ Object
readonly
Returns the value of attribute join.
-
#padding ⇒ Object
readonly
Returns the value of attribute padding.
-
#text_color ⇒ Object
readonly
Returns the value of attribute text_color.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(join: false, indicator: nil, input_type: :checkbox, bg_color: nil, text_color: nil, border_color: nil, padding: nil, name: nil, **system_arguments) ⇒ Accordion
constructor
A new instance of Accordion.
Constructor Details
#initialize(join: false, indicator: nil, input_type: :checkbox, bg_color: nil, text_color: nil, border_color: nil, padding: nil, name: nil, **system_arguments) ⇒ Accordion
Returns a new instance of Accordion.
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'app/components/daisy_ui/data_display/accordion.rb', line 91 def initialize(join: false, indicator: nil, input_type: :checkbox, bg_color: nil, text_color: nil, border_color: nil, padding: nil, name: nil, **system_arguments) @join = join @indicator = indicator @input_type = input_type @bg_color = bg_color || 'bg-base-100' @text_color = text_color @border_color = border_color || 'border border-base-300' @padding = padding @input_name = name || "accordion-#{SecureRandom.uuid}" super(**system_arguments) end |
Instance Attribute Details
#bg_color ⇒ Object (readonly)
Returns the value of attribute bg_color.
80 81 82 |
# File 'app/components/daisy_ui/data_display/accordion.rb', line 80 def bg_color @bg_color end |
#border_color ⇒ Object (readonly)
Returns the value of attribute border_color.
80 81 82 |
# File 'app/components/daisy_ui/data_display/accordion.rb', line 80 def border_color @border_color end |
#indicator ⇒ Object (readonly)
Returns the value of attribute indicator.
80 81 82 |
# File 'app/components/daisy_ui/data_display/accordion.rb', line 80 def indicator @indicator end |
#input_type ⇒ Object (readonly)
Returns the value of attribute input_type.
80 81 82 |
# File 'app/components/daisy_ui/data_display/accordion.rb', line 80 def input_type @input_type end |
#join ⇒ Object (readonly)
Returns the value of attribute join.
80 81 82 |
# File 'app/components/daisy_ui/data_display/accordion.rb', line 80 def join @join end |
#padding ⇒ Object (readonly)
Returns the value of attribute padding.
80 81 82 |
# File 'app/components/daisy_ui/data_display/accordion.rb', line 80 def padding @padding end |
#text_color ⇒ Object (readonly)
Returns the value of attribute text_color.
80 81 82 |
# File 'app/components/daisy_ui/data_display/accordion.rb', line 80 def text_color @text_color end |
Instance Method Details
#call ⇒ Object
105 106 107 108 109 110 111 |
# File 'app/components/daisy_ui/data_display/accordion.rb', line 105 def call return safe_join(items || []) unless @join tag.div(**html_attributes) do safe_join(items || []) end end |