Section

<k.Section> puts a heading, a description and an "(i)" over the blocks inside it. Inside, blocks are laid out as on the page: two half-row blocks side by side, a whole-row block on its own. With columns={3}, half-row blocks sit three across when each gets about 380 pixels, else two; leave out the title for a bare row of three.

Example

regions.sql:

-- Sales and orders per region
select 'North' as region, 120 as sales, 14 as orders
union all select 'South', 95, 9
union all select 'East', 180, 16

In report.tsx:

import regions from "./regions.sql?raw"

type Row = { region: string; sales: number; orders: number }

// in defineReport({ … })
queries: { regions: query<Row>(regions) },
blocks: (k) => [
  <k.Section
    key="regions"
    title="Regions"
    description="How the regions compare."
    info={{ what: "Sales and orders per region.", sql: ["regions"] }}
  >
    <k.CategoryBars key="sales" series="regions" x="region" value="sales" title="Sales" />
    <k.CategoryBars key="orders" series="regions" x="region" value="orders" title="Orders" />
  </k.Section>,
],

Props

NameTypeRequiredDefaultMeaning
keytextyesA name unique on the page
titletext, or a function of the datanoThe heading; without it, no heading row
descriptiontext, or a function of the datanoA muted line under the heading
info{ what, rules, sql }noThe section's "(i)"
columns2 or 3no2Half-row blocks two or three across
childrenblocksyesThe blocks inside

A section holds only blocks. It always takes the whole row.

Checks

A prop the section does not take, or a columns other than 2 or 3, fails the typecheck.