Class: Daisy::DataDisplay::TableComponent::SectionComponent

Inherits:
LocoMotion::BasicComponent show all
Defined in:
app/components/daisy/data_display/table_component.rb

Overview

A component for grouping related table content into sections. Each section can have its own header and body, allowing for complex table layouts.

Instance Method Summary collapse

Methods inherited from LocoMotion::BasicComponent

name

Instance Method Details

#before_renderObject



184
185
186
# File 'app/components/daisy/data_display/table_component.rb', line 184

def before_render
  set_tag_name :component, :section
end

#callObject



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'app/components/daisy/data_display/table_component.rb', line 188

def call
  # Sections can't be rendered inside a `<table>` tag, so we don't render the
  # typical `part(:component)` here.
  concat(head) if head?

  if body?
    concat(body)
  else
    (:tbody) do
      rows.each do |row|
        concat(row)
      end
    end
  end
end