Class: UI::ContextMenuCheckboxItem
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::ContextMenuCheckboxItem
- Includes:
- ContextMenuCheckboxItemBehavior
- Defined in:
- app/components/ui/context_menu_checkbox_item.rb
Overview
CheckboxItem - Phlex implementation
A menu item with checkbox functionality. Uses ContextMenuCheckboxItemBehavior concern for shared styling logic.
Instance Method Summary collapse
-
#initialize(checked: false, classes: "", **attributes) ⇒ ContextMenuCheckboxItem
constructor
A new instance of ContextMenuCheckboxItem.
- #view_template(&block) ⇒ Object
Methods included from ContextMenuCheckboxItemBehavior
#context_menu_checkbox_item_classes, #context_menu_checkbox_item_data_attributes, #context_menu_checkbox_item_html_attributes
Constructor Details
#initialize(checked: false, classes: "", **attributes) ⇒ ContextMenuCheckboxItem
Returns a new instance of ContextMenuCheckboxItem.
16 17 18 19 20 |
# File 'app/components/ui/context_menu_checkbox_item.rb', line 16 def initialize(checked: false, classes: "", **attributes) @checked = checked @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'app/components/ui/context_menu_checkbox_item.rb', line 22 def view_template(&block) div(**.deep_merge(@attributes)) do span(class: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center") do if @checked render_check_icon end end yield if block_given? end end |