セクションリストSectionListExperimental
The grouped-list / sectioned layout: a sequence of sections, each a heading band (title + sublabel + a right-aligned group aggregate) over the caller's body rows, with an optional per-group subtotal footer. The grouping spine every history / 利用明細 / 取引履歴 / statement / invoice-by-客先 screen hand-rolls — groupBy + a section header + a per-group subtotal. Body-agnostic: drop in ListCards (mobile history), a Table (desktop invoices), or signed ledger rows. The caller owns the grouping + subtotal math + any cross-group selection; this owns the consistent header/footer chrome + the sectioned a11y structure. Distinct from StatusBoard.groups (status tiles) and Itinerary.days (a trip timeline). sections[] of {key,title,sublabel?,meta?,content,footer?}; stickyHeaders optional. RSC-safe.
プレビュー
Props
| プロパティ | 型 | 初期値 | 説明 |
|---|---|---|---|
| sections | SectionListSection[] | - | 事前グループ化したセクション(groupBy は呼び出し側)。各=見出し帯+本文+任意の小計フッター。 |
| stickyHeaders | boolean | false | スクロール中セクション見出しを上部に固定。 |
| label | ReactNode | - | グループ全体のアクセシブル名。 |
| SectionListSection.key | string | number | - | セクションの安定キー。 |
| SectionListSection.title / sublabel | ReactNode | - | グループ見出し(荷主/締め/月)+副次。 |
| SectionListSection.meta | ReactNode | - | 見出し右寄せのグループ集計(小計¥…/N件)。 |
| SectionListSection.content | ReactNode | - | セクション本文=呼び出し側の行(ListCard/Table/台帳行)。 |
| SectionListSection.footer | ReactNode | - | グループごとの小計フッター帯(任意)。 |
Usage
import { SectionList, ListCard, type SectionListSection } from "@gunjo/ui"
// The caller owns the groupBy + subtotal math; SectionList owns the header/footer chrome.
const sections: SectionListSection[] = groups.map((g) => ({
key: g.key,
title: g.title, // 2026年6月末締め
sublabel: `${g.rows.length}社`,
meta: `小計 ¥${subtotal(g).toLocaleString()}`, // right-aligned group aggregate
content: g.rows.map((r) => <ListCard key={r.id} title={r.title} status={yen(r.amount)} />),
footer: <><span>締め小計</span><span>¥{subtotal(g).toLocaleString()}</span></>,
}))
<SectionList sections={sections} label="締め別 請求一覧" />