Class: PhlexKit::TableHead

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/table/table_head.rb

Overview

A header cell () in a PhlexKit::TableHeader row. See table.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ TableHead

Returns a new instance of TableHead.



4
5
6
# File 'app/components/phlex_kit/table/table_head.rb', line 4

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_template(&block) ⇒ Object



8
9
10
11
12
13
14
15
# File 'app/components/phlex_kit/table/table_head.rb', line 8

def view_template(&block)
  # scope="col" is the common case (header cells sit in a TableHeader row);
  # a generated default, not a merged attr — `mix` would fuse a caller's
  # `scope: "row"` into "col row" — so skip it when the caller sets scope.
  base = { class: "pk-table-head" }
  base[:scope] = "col" unless attr_set?(:scope)
  th(**mix(base, @attrs), &block)
end