Class: UI::MenubarCheckboxItem
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::MenubarCheckboxItem
- Includes:
- MenubarCheckboxItemBehavior
- Defined in:
- app/components/ui/menubar_checkbox_item.rb
Overview
CheckboxItem - Phlex implementation
A menu item with checkbox functionality.
Instance Method Summary collapse
-
#initialize(checked: false, disabled: false, classes: "", **attributes) ⇒ MenubarCheckboxItem
constructor
A new instance of MenubarCheckboxItem.
- #view_template(&block) ⇒ Object
Methods included from MenubarCheckboxItemBehavior
#menubar_checkbox_item_classes, #menubar_checkbox_item_data_attributes, #menubar_checkbox_item_html_attributes
Constructor Details
#initialize(checked: false, disabled: false, classes: "", **attributes) ⇒ MenubarCheckboxItem
Returns a new instance of MenubarCheckboxItem.
16 17 18 19 20 21 |
# File 'app/components/ui/menubar_checkbox_item.rb', line 16 def initialize(checked: false, disabled: false, classes: "", **attributes) @checked = checked @disabled = disabled @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/ui/menubar_checkbox_item.rb', line 23 def view_template(&block) div(**.deep_merge(@attributes)) do # Check indicator container span(class: "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 |