AdaptTable for Spartan

Column groups in Spartan

A parent with children is a column group: its caption spans its columns in a header row of its own. This table has three, open by default; collapse one to see how it folds.

Assignment is Team + Status with collapsedKey: "team", so it keeps Team. Delivery is Timeline + Budget with collapsedRender, so it draws the budget in one cell. Workload has neither, so it folds to a narrow stub.

collapsibleColumnGroups arms the toggles. The group headers use Spartan buttons.

The code

import { Component, input } from "@angular/core";
import type { ColumnInput } from "@adapttable/angular";
import { AdaptDataTable } from "@adapttable/spartan";
import { collapsibleColumnGroups } from "@adapttable/spartan/column-groups";

interface Member {
  id: string;
  name: string;
  team: string;
  status: string;
  budget: number;
}

const columns: ColumnInput<Member>[] = [
  { key: "name", header: "Name" },
  {
    header: "Assignment",
    collapsedKey: "team",
    children: [
      { key: "team", header: "Team" },
      { key: "status", header: "Status" },
    ],
  },
  {
    header: "Budget",
    collapsedRender: (row) => `$${row.budget}`,
    children: [{ key: "budget", header: "Amount" }],
  },
];

@Component({
  selector: "app-members",
  imports: [AdaptDataTable],
  template: `
    <adapt-data-table
      [data]="rows()"
      [columns]="columns"
      [rowKey]="rowKey"
      [features]="features"
    />
  `,
})
export class Members {
  readonly rows = input.required<readonly Member[]>();
  readonly columns = columns;
  readonly rowKey = (row: Member) => row.id;
  readonly features = [collapsibleColumnGroups()];
}

Install

# Follow the kit setup guide for compatible peers
pnpm add @adapttable/spartan @adapttable/angular @spartan-ng/brain@1.5.0 @angular/cdk@^22 @angular/forms@^22 rxjs@^7.8.0 tailwindcss@^4 clsx@^2.1.1 tw-animate-css@^1

The same feature in the other kits

More Spartan features

Reference: column-groups, columns. More of this kit: AdaptTable for Spartan, or the live demo.