Class: PhlexKit::DropdownMenuCheckboxItem
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::DropdownMenuCheckboxItem
- Defined in:
- app/components/phlex_kit/dropdown_menu/dropdown_menu_checkbox_item.rb
Overview
Toggleable menu row, ported from shadcn/ui's DropdownMenuCheckboxItem: a
Instance Method Summary collapse
-
#initialize(checked: false, name: nil, value: "1", **attrs) ⇒ DropdownMenuCheckboxItem
constructor
A new instance of DropdownMenuCheckboxItem.
- #view_template(&block) ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(checked: false, name: nil, value: "1", **attrs) ⇒ DropdownMenuCheckboxItem
Returns a new instance of DropdownMenuCheckboxItem.
7 8 9 10 11 12 |
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_checkbox_item.rb', line 7 def initialize(checked: false, name: nil, value: "1", **attrs) @checked = checked @name = name @value = value @attrs = attrs end |
Instance Method Details
#view_template(&block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_checkbox_item.rb', line 14 def view_template(&block) label(**mix({ class: "pk-dropdown-menu-item pk-dropdown-menu-checkbox-item", role: "menuitemcheckbox" }, @attrs)) do input(type: :checkbox, class: "pk-dropdown-menu-item-input", name: @name, value: @value, checked: @checked) span(class: "pk-dropdown-menu-item-indicator", aria: { hidden: "true" }) { check_icon } yield if block end end |