Class: Blacklight::System::DropdownButtonComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/system/dropdown_button_component.rb

Constant Summary

Constants inherited from Component

Component::EXCLUDE_VARIABLES

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

Constructor Details

#initialize(label:, classes: %w[btn btn-outline-secondary dropdown-toggle])) ⇒ DropdownButtonComponent

Returns a new instance of DropdownButtonComponent.



6
7
8
9
# File 'app/components/blacklight/system/dropdown_button_component.rb', line 6

def initialize(label:, classes: %w[btn btn-outline-secondary dropdown-toggle])
  @classes = classes
  @label = label
end

Instance Method Details

#callObject



11
12
13
14
15
# File 'app/components/blacklight/system/dropdown_button_component.rb', line 11

def call
  button_tag class: @classes, aria: { expanded: false }, data: { toggle: 'dropdown', 'bs-toggle': 'dropdown' } do
    safe_join([@label, (:span, '', class: 'caret')])
  end
end