Class: PhlexKit::CommandItem

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/command/command_item.rb

Overview

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(value:, text: "", href: "#", **attrs) ⇒ CommandItem

Returns a new instance of CommandItem.



6
7
8
9
10
11
# File 'app/components/phlex_kit/command/command_item.rb', line 6

def initialize(value:, text: "", href: "#", **attrs)
  @value = value
  @text = text
  @href = href
  @attrs = attrs
end

Instance Method Details

#view_templateObject



13
14
15
16
17
18
19
20
# File 'app/components/phlex_kit/command/command_item.rb', line 13

def view_template(&)
  a(**mix({
    class: "pk-command-item",
    href: @href,
    role: "option",
    data: { phlex_kit__command_target: "item", value: @value, text: @text }
  }, @attrs), &)
end