Row Expansion Customization

Expand rows to display custom content below each row. This demo renders a sub-component that shows the full row data as formatted JSON when a row is expanded.


Username Account Status Role Avg Session Duration Company Name Last Visited At Visit Count
Robert.Kling-Monahan
pending admin 25 Hintz - Heidenreich 06 Sep 2025 06:15:10 PDT 3
Laila.Jakubowski3
suspended admin 118 Breitenberg, Farrell and Feil 24 Jul 2024 19:58:35 PDT 3
Kory_Hintz
pending moderator 50 Heller - MacGyver 09 Jul 2025 11:44:35 PDT 246
Coleman.Gutmann
active admin 66 Cruickshank Inc 13 Oct 2025 09:06:34 PDT 3
Ashtyn.Hand51
active admin 118 Gulgowski Group 23 Mar 2025 02:45:49 PDT 152
Dayne.Frami
active user 47 Schinner, Koepp and Flatley 08 Nov 2024 11:10:35 PDT 307
Casper.Connelly
active user 118 Okuneva Inc 03 Oct 2025 09:54:34 PDT 7
Verner_Hegmann29
pending admin 110 Parker - Osinski 06 Sep 2025 03:46:46 PDT 315
Maddison.Schulist50
active admin 103 Langosh-Senger, Mante-Grimes and Ratke 24 Jan 2025 15:59:17 PDT 82
Brycen_Farrell24
suspended user 116 Schimmel - Kub 25 Sep 2025 14:52:25 PDT 3
import {JsonPipe} from "@angular/common"
import {Component} from "@angular/core"

import {ButtonModule} from "@qualcomm-ui/angular/button"
import {ProgressRingModule} from "@qualcomm-ui/angular/progress-ring"
import {createAngularTable, TableModule} from "@qualcomm-ui/angular/table"
import {getCoreRowModel, getExpandedRowModel} from "@qualcomm-ui/core/table"

import {createUserQuery, type User, userColumns} from "./data"

@Component({
  imports: [TableModule, ButtonModule, ProgressRingModule, JsonPipe],
  selector: "row-expansion-customization-demo",
  template: `
    <div q-table-root>
      <div q-table-action-bar>
        <button
          q-button
          size="sm"
          variant="outline"
          [disabled]="query.isFetching()"
          (click)="query.refetch()"
        >
          Refresh Data
        </button>
        @if (query.isFetching()) {
          <div q-progress-ring size="xs"></div>
        }
      </div>
      <div q-table-scroll-container>
        <table q-table-table>
          <thead q-table-header>
            @for (
              headerGroup of table.getHeaderGroups();
              track headerGroup.id
            ) {
              <tr q-table-row>
                @for (header of headerGroup.headers; track header.id) {
                  <th
                    q-table-header-cell
                    [attr.colspan]="header.colSpan"
                    [style.minWidth.px]="header.column.columnDef.minSize"
                  >
                    @if (!header.isPlaceholder) {
                      <ng-container *renderHeader="header; let value">
                        {{ value }}
                      </ng-container>
                    }
                  </th>
                }
              </tr>
            }
          </thead>
          <tbody q-table-body>
            @for (row of table.getRowModel().rows; track row.id) {
              <tr q-table-row>
                @for (cell of row.getVisibleCells(); track cell.id) {
                  <td q-table-cell>
                    <ng-container *renderCell="cell; let value">
                      {{ value }}
                    </ng-container>
                  </td>
                }
              </tr>
              @if (row.getIsExpanded()) {
                <tr q-table-row>
                  <td
                    q-table-cell
                    [attr.colspan]="row.getVisibleCells().length"
                  >
                    <pre
                      class="w-fit rounded bg-transparent p-2 font-mono text-xs"
                      >{{ row.original | json }}</pre>
                  </td>
                </tr>
              }
            }
          </tbody>
        </table>
      </div>
    </div>
  `,
})
export class RowExpansionCustomizationDemo {
  protected readonly query = createUserQuery(10)

  protected table = createAngularTable<User>(() => ({
    columns: userColumns,
    data: this.query.data() || [],
    getCoreRowModel: getCoreRowModel(),
    getExpandedRowModel: getExpandedRowModel(),
    getRowCanExpand: () => true,
  }))
}
Updated by Ryan Bower