Class: UI::DropdownMenuCheckboxItemComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
DropdownMenuCheckboxItemBehavior
Defined in:
app/view_components/ui/dropdown_menu_checkbox_item_component.rb

Overview

CheckboxItemComponent - ViewComponent implementation

Instance Method Summary collapse

Methods included from DropdownMenuCheckboxItemBehavior

#checkbox_indicator, #dropdown_menu_checkbox_item_classes, #dropdown_menu_checkbox_item_data_attributes, #dropdown_menu_checkbox_item_html_attributes

Constructor Details

#initialize(checked: false, disabled: false, classes: "", **attributes) ⇒ DropdownMenuCheckboxItemComponent

Returns a new instance of DropdownMenuCheckboxItemComponent.



7
8
9
10
11
12
# File 'app/view_components/ui/dropdown_menu_checkbox_item_component.rb', line 7

def initialize(checked: false, disabled: false, classes: "", **attributes)
  @checked = checked
  @disabled = disabled
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
# File 'app/view_components/ui/dropdown_menu_checkbox_item_component.rb', line 14

def call
   :div, **dropdown_menu_checkbox_item_html_attributes.merge(@attributes.except(:data)) do
    safe_join([
      checkbox_indicator_html,
      content
    ])
  end
end