@@ -214,4 +214,58 @@ class CustomCellComponent {
214
214
}
215
215
```
216
216
217
+ Alternatively, you can render a component into a specific column header, cell, or footer by passing the component type
218
+ to the corresponding column definitions. These column definitions will be provided to the ` flexRender ` directive along with the ` context ` .
217
219
220
+ ``` ts
221
+ import {FlexRenderComponent } from " @tanstack/angular-table" ;
222
+
223
+ class AppComponent {
224
+ columns: ColumnDef <Person >[] = [
225
+ {
226
+ id: ' select' ,
227
+ header : () => TableHeadSelectionComponent < Person > ,
228
+ cell : () => TableRowSelectionComponent < Person > ,
229
+ },
230
+ ]
231
+ }
232
+ ```
233
+
234
+ ``` angular2html
235
+ <ng-container
236
+ *flexRender="
237
+ header.column.columnDef.header;
238
+ props: header.getContext();
239
+ let headerCell
240
+ "
241
+ >
242
+ {{ headerCell }}
243
+ </ng-container>
244
+ ```
245
+
246
+ Properties of ` context ` provided in the ` flexRender ` directive will be accessible to your component.
247
+ You can explicitly define the context properties required by your component.
248
+ In this example, the context provided to flexRender is of type HeaderContext.
249
+ Input signal ` table ` , which is a property of HeaderContext together with ` column ` and ` header ` properties,
250
+ is then defined to be used in the component. If any of the context properties are
251
+ needed in your component, feel free to use them. Please take note that only input signal is supported,
252
+ when defining access to context properties, using this approach.
253
+
254
+ ``` ts
255
+ @Component ({
256
+ template: `
257
+ <input
258
+ type="checkbox"
259
+ [checked]="table().getIsAllRowsSelected()"
260
+ [indeterminate]="table().getIsSomeRowsSelected()"
261
+ (change)="table().toggleAllRowsSelected()"
262
+ />
263
+ ` ,
264
+ // ...
265
+ })
266
+ export class TableHeadSelectionComponent <T > {
267
+ // column = input.required<Column<T, unknown>>()
268
+ // header = input.required<Header<T, unknown>>()
269
+ table = input .required <Table <T >>()
270
+ }
271
+ ```
0 commit comments