Class: PhlexKit::CommandItem
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::CommandItem
- Defined in:
- app/components/phlex_kit/command/command_item.rb
Overview
Instance Method Summary collapse
-
#initialize(value:, text: "", href: "#", disabled: false, **attrs) ⇒ CommandItem
constructor
A new instance of CommandItem.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(value:, text: "", href: "#", disabled: false, **attrs) ⇒ CommandItem
Returns a new instance of CommandItem.
8 9 10 11 12 13 14 |
# File 'app/components/phlex_kit/command/command_item.rb', line 8 def initialize(value:, text: "", href: "#", disabled: false, **attrs) @value = value @text = text @href = href @disabled = disabled @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/phlex_kit/command/command_item.rb', line 16 def view_template(&) a(**mix({ class: "pk-command-item", href: @href, role: "option", aria: { disabled: (@disabled ? "true" : nil) }, data: { phlex_kit__command_target: "item", value: @value, text: @text, disabled: (@disabled ? "true" : nil) } }, @attrs), &) end |