@@ -24,6 +24,7 @@ import { NbComponentOrCustomStatus } from '../component-status';
2424import { NbBadgePosition } from '../badge/badge.component' ;
2525import { NbIconConfig } from '../icon/icon.component' ;
2626import { NbTabContentDirective } from './tab-content.directive' ;
27+ import { NbTabTitleDirective } from './tab-title.directive' ;
2728
2829/**
2930 * Specific tab container.
@@ -51,6 +52,7 @@ import { NbTabContentDirective } from './tab-content.directive';
5152} )
5253export class NbTabComponent {
5354 @ContentChild ( NbTabContentDirective ) tabContentDirective : NbTabContentDirective ;
55+ @ContentChild ( NbTabTitleDirective ) tabTitleDirective : NbTabTitleDirective ;
5456
5557 /**
5658 * Tab title
@@ -248,6 +250,9 @@ export class NbTabComponent {
248250 * </nb-tabset>
249251 * ```
250252 *
253+ * You can provide a template as a tab title via `<ng-template nbTabTitle>`:
254+ * @stacked -example(Tab title template, tabset/tabset-template-title.component)
255+ *
251256 * @styles
252257 *
253258 * tabset-background-color:
@@ -309,7 +314,13 @@ export class NbTabComponent {
309314 >
310315 <a href (click)="$event.preventDefault()" tabindex="-1" class="tab-link">
311316 <nb-icon *ngIf="tab.tabIcon" [config]="tab.tabIcon"></nb-icon>
312- <span *ngIf="tab.tabTitle" class="tab-text">{{ tab.tabTitle }}</span>
317+ <ng-container
318+ *ngIf="tab.tabTitleDirective; else textTitleTemplate"
319+ [ngTemplateOutlet]="tab.tabTitleDirective.templateRef"
320+ ></ng-container>
321+ <ng-template #textTitleTemplate>
322+ <span class="tab-text">{{ tab.tabTitle }}</span>
323+ </ng-template>
313324 </a>
314325 <nb-badge
315326 *ngIf="tab.badgeText || tab.badgeDot"
0 commit comments