Skip to content

CDK Table: cdk-thead directive #12402

@ZackDeRose

Description

@ZackDeRose

Bug, feature request, or proposal:

Feature Request

What is the expected behavior?

CDK Tables - optional exposure of the <thead>/<tbody>/<tfoot> in the template via a cdk-thead/cdk-tbody/cdk-tfoot directive.

I would expect the something like the following template to be supported:

<table cdk-table [dataSource]="dataSource">

  <!-- User name Definition -->
  <ng-container cdkColumnDef="username">
    <th cdk-header-cell *cdkHeaderCellDef> User name </th>
    <td cdk-cell *cdkCellDef="let row"> {{row.username}} </td>
  </ng-container>

  <!-- Header and Row Declarations -->
  <thead cdk-thead class="thead-dark">
    <tr cdk-header-row *cdkHeaderRowDef="['username', 'age', 'title']"></tr>
  </thead>
  <tr cdk-row *cdkRowDef="let row; columns: ['username', 'age', 'title']"></tr>

</table>

[Expanded on from the template provided in the overview]

What is the current behavior?

The tags are not [documented as?] something that you can place inside the cdk-table template.

What are the steps to reproduce?

n/a

What is the use-case or motivation for changing an existing behavior?

CDK Tables are awesome for un-opinionated tables, especially given their easy integration with external CSS frameworks like bootstrap. Lack of access easy access to <thead>/<tbody>/<tfoot> in the template feels then like something of a gap given what CDK-tables seem to be trying to achieve, and its ability to support a CSS framework that applies classes to these tags.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

n/a

Is there anything else we should know?

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/tablefeatureThis issue represents a new feature or feature request rather than a bug or bug fixneeds: discussionFurther discussion with the team is needed before proceeding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions