Class: PhlexKit::CommandGroup

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

Overview

Titled group of CommandItems. Hidden by the controller when filtering leaves it empty. The heading keeps ruby_ui's [group-heading] attribute (styled via the attribute selector in command.css). See command.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(title: nil, **attrs) ⇒ CommandGroup

Returns a new instance of CommandGroup.



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

def initialize(title: nil, **attrs)
  @title = title
  @attrs = attrs
end

Instance Method Details

#view_template(&block) ⇒ Object



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

def view_template(&block)
  div(**mix({
    class: "pk-command-group",
    role: "presentation",
    data: { value: @title, phlex_kit__command_target: "group" }
  }, @attrs)) do
    render_header if @title
    render_items(&block)
  end
end