About this set
A purchase order split into Furniture, Hardware and Software, each group with a shaded header row that shows the item count and the group’s quantity and cost subtotals, and a grand total in the table footer. Click a group header, or Tab to it and press Enter or Space, to collapse or expand that group. Each group is its own tbody element, which HTML allows any number of, so the structure lives in the markup instead of in classes. The header row’s first cell is a row group header that holds a button with aria-expanded, and the script sets the hidden attribute on the other rows of the same tbody. The chevron rotates from the aria-expanded value, and clicking anywhere on the header row does the same as the button. Item rows are indented so they read as children of their group, and the footer uses a heavier top border and bold figures. Use it for orders, budgets, timesheets and inventory grouped by category. The Software group starts collapsed to show both states.
What’s included
- One tbody per group, grand total in tfoot
- Group headers are buttons with aria-expanded
- Collapsed rows use the hidden attribute
- Subtotals and an item count on every group header
- Chevron turn that stops under reduced motion
Accessibility
The caption describes the grouping, column headers use scope="col", group titles are th elements with scope="rowgroup" and the grand total label uses scope="row". Each group toggle is a native button with aria-expanded and a visible 2px focus outline, and the item count includes hidden text so it is read as 3 items. The chevron rotation is removed under prefers-reduced-motion.
Customise it
Group header shading is #f7f8fb on .grp tr.head (plain CSS), --bs-table-bg on the head rows (Bootstrap) or bg-[#f7f8fb] on the head rows (Tailwind). The child indent is the 38px left padding on the first cell of item rows.




















