- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Questionnaire
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner (Toast)
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
- Trace
Tabs
A set of layered sections of content—known as tab panels—that are displayed one at a time.
Account
Make changes to your account here. Click save when you're done.
Password
Change your password here. After saving, you'll be logged out.
import { Component } from '@angular/core';
import { HlmButtonImports } from '@spartan-ng/helm/button';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmInputImports } from '@spartan-ng/helm/input';
import { HlmLabelImports } from '@spartan-ng/helm/label';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-preview',
imports: [HlmTabsImports, HlmCardImports, HlmLabelImports, HlmInputImports, HlmButtonImports],
host: {
class: 'block w-full max-w-lg',
},
template: `
<hlm-tabs tab="account" class="w-full">
<hlm-tabs-list aria-label="tabs example">
<button hlmTabsTrigger="account">Account</button>
<button hlmTabsTrigger="password">Password</button>
</hlm-tabs-list>
<div hlmTabsContent="account">
<section hlmCard>
<div hlmCardHeader>
<h3 hlmCardTitle>Account</h3>
<p hlmCardDescription>Make changes to your account here. Click save when you're done.</p>
</div>
<p hlmCardContent>
<label class="my-4 block" hlmLabel>
Name
<input class="mt-1.5 w-full" value="Pedro Duarte" hlmInput />
</label>
<label class="my-4 block" hlmLabel>
Username
<input class="mt-1.5 w-full" placeholder="@peduarte" hlmInput />
</label>
</p>
<div hlmCardFooter>
<button hlmBtn>Save Changes</button>
</div>
</section>
</div>
<div hlmTabsContent="password">
<section hlmCard>
<div hlmCardHeader>
<h3 hlmCardTitle>Password</h3>
<p hlmCardDescription>Change your password here. After saving, you'll be logged out.</p>
</div>
<p hlmCardContent>
<label class="my-4 block" hlmLabel>
Old Password
<input class="mt-1.5 w-full" type="password" hlmInput />
</label>
<label class="my-4 block" hlmLabel>
New Password
<input class="mt-1.5 w-full" type="password" hlmInput />
</label>
</p>
<div hlmCardFooter>
<button hlmBtn>Save Password</button>
</div>
</section>
</div>
</hlm-tabs>
`,
})
export class TabsPreview {}Installation
ng g @spartan-ng/cli:ui tabsnx g @spartan-ng/cli:ui tabsimport { OVERLAY_DEFAULT_CONFIG } from '@angular/cdk/overlay';
import { brnClasses, type BrnClassesOptions } from '@spartan-ng/brain/core';
import { cn, type ClassValue } from 'cn';
import { createCn } from 'cn/config';
import { makeEnvironmentProviders, type EnvironmentProviders } from '@angular/core';
import { provideSpartanHlm } from '@spartan-ng/helm/utils';
/**
* Merges class values and resolves Tailwind CSS conflicts.
*
* To customize the merge (e.g. register custom theme values), create your own instance:
*
* @example
* ```ts
*
*
* export const hlm = createCn({
* extend: { classGroups: { 'font-size': [{ text: ['hero'] }] } },
* });
* ```
*/
export const hlm = cn;
/**
* This function dynamically adds and removes classes for a given element without requiring
* the a class binding (e.g. `[class]="..."`) which may interfere with other class bindings.
* The classes are merged with `hlm`.
*/
export function classes(computed: () => ClassValue[] | string, options: Omit<BrnClassesOptions, 'merge'> = {}) {
brnClasses(computed, { ...options, merge: hlm });
}
/**
* Provides default configuration for Spartan Helm components.
*
* This utility configures the Angular CDK overlay to disable the `usePopover`
* behavior introduced in Angular 21, which causes CDK overlay-based components
* (sheets, dialogs, tooltips, etc.) to render above `position: fixed` elements
* like `<hlm-toaster>`.
*
* @returns {EnvironmentProviders} Environment providers to be added to the application config.
*
* @example
* ```ts
* // app.config.ts
*
*
* export const appConfig: ApplicationConfig = {
* providers: [
* provideSpartanHlm(),
* // ... other providers
* ],
* };
* ```
*/
export function provideSpartanHlm(): EnvironmentProviders {
return makeEnvironmentProviders([
{
provide: OVERLAY_DEFAULT_CONFIG,
useValue: { usePopover: false },
},
]);
}import { BrnTabs, BrnTabsContent, BrnTabsContentLazy, BrnTabsList, BrnTabsPaginatedList, BrnTabsTrigger, type BrnPaginatedTabHeaderItem } from '@spartan-ng/brain/tabs';
import { CdkObserveContent } from '@angular/cdk/observers';
import { ChangeDetectionStrategy, Component, Directive, computed, contentChildren, input, viewChild, type ElementRef } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { buttonVariants } from '@spartan-ng/helm/button';
import { classes, hlm } from '@spartan-ng/helm/utils';
import { cva, type VariantProps } from 'class-variance-authority';
import { lucideChevronLeft, lucideChevronRight } from '@ng-icons/lucide';
import { toObservable } from '@angular/core/rxjs-interop';
import { type ClassValue } from 'cn';
import { type Observable } from 'rxjs';
@Directive({
selector: 'ng-template[hlmTabsContentLazy]',
exportAs: 'hlmTabsContentLazy',
hostDirectives: [BrnTabsContentLazy],
})
export class HlmTabsContentLazy {}
@Directive({
selector: '[hlmTabsContent]',
exportAs: 'hlmTabsContent',
hostDirectives: [{ directive: BrnTabsContent, inputs: ['brnTabsContent: hlmTabsContent'] }],
host: {
'data-slot': 'tabs-content',
},
})
export class HlmTabsContent {
public readonly contentFor = input.required<string>({ alias: 'hlmTabsContent' });
constructor() {
classes(() => 'flex-1 text-sm outline-none');
}
}
export const listVariants = cva(
'rounded-lg p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col',
{
variants: {
variant: {
default: 'bg-muted',
line: 'gap-1 bg-transparent',
},
},
defaultVariants: {
variant: 'default',
},
},
);
type ListVariants = VariantProps<typeof listVariants>;
@Directive({
selector: '[hlmTabsList],hlm-tabs-list',
exportAs: 'hlmTabsList',
hostDirectives: [BrnTabsList],
host: {
'data-slot': 'tabs-list',
'[attr.data-variant]': 'variant()',
},
})
export class HlmTabsList {
public readonly variant = input<ListVariants['variant']>('default');
constructor() {
classes(() => listVariants({ variant: this.variant() }));
}
}
@Component({
selector: 'hlm-paginated-tabs-list',
exportAs: 'hlmTabsPaginatedList',
imports: [CdkObserveContent, NgIcon],
providers: [provideIcons({ lucideChevronRight, lucideChevronLeft })],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'data-slot': 'tabs-paginated-list',
},
template: `
<button
#previousPaginator
data-pagination="previous"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollBefore || null"
(click)="_handlePaginatorClick('before')"
(mousedown)="_handlePaginatorPress('before', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronLeft" />
</button>
<div #tabListContainer class="z-[1] flex grow overflow-hidden" (keydown)="_handleKeydown($event)">
<div class="relative grow transition-transform" #tabList role="tablist" (cdkObserveContent)="_onContentChanges()">
<div #tabListInner [class]="_tabListClass()">
<ng-content />
</div>
</div>
</div>
<button
#nextPaginator
data-pagination="next"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollAfter || null"
(click)="_handlePaginatorClick('after')"
(mousedown)="_handlePaginatorPress('after', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronRight" />
</button>
`,
})
export class HlmTabsPaginatedList extends BrnTabsPaginatedList {
constructor() {
super();
classes(() => 'relative flex flex-shrink-0 items-center gap-1 overflow-hidden');
}
public readonly items = contentChildren(BrnTabsTrigger, { descendants: false });
/** Explicitly annotating type to avoid non-portable inferred type */
public readonly itemsChanges: Observable<ReadonlyArray<BrnPaginatedTabHeaderItem>> = toObservable(this.items);
public readonly tabListContainer = viewChild.required<ElementRef<HTMLElement>>('tabListContainer');
public readonly tabList = viewChild.required<ElementRef<HTMLElement>>('tabList');
public readonly tabListInner = viewChild.required<ElementRef<HTMLElement>>('tabListInner');
public readonly nextPaginator = viewChild.required<ElementRef<HTMLElement>>('nextPaginator');
public readonly previousPaginator = viewChild.required<ElementRef<HTMLElement>>('previousPaginator');
public readonly tabListClass = input<ClassValue>('', { alias: 'tabListClass' });
protected readonly _tabListClass = computed(() => hlm(listVariants(), this.tabListClass()));
public readonly paginationButtonClass = input<ClassValue>('');
protected readonly _paginationButtonClass = computed(() =>
hlm(
'relative z-[2] select-none disabled:cursor-default',
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
this.paginationButtonClass(),
this.showPaginationControls() ? 'inline-flex' : 'hidden',
),
);
protected _itemSelected(_event: KeyboardEvent) {
/* noop - the native button activation selects the focused tab */
}
}
@Directive({
selector: '[hlmTabsTrigger]',
exportAs: 'hlmTabsTrigger',
hostDirectives: [{ directive: BrnTabsTrigger, inputs: ['brnTabsTrigger: hlmTabsTrigger', 'disabled'] }],
host: {
'data-slot': 'tabs-trigger',
},
})
export class HlmTabsTrigger {
public readonly triggerFor = input.required<string>({ alias: 'hlmTabsTrigger' });
constructor() {
classes(() => [
`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_ng-icon:not([class*='text-'])]:text-[length:--spacing(4)] focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_ng-icon]:pointer-events-none [&_ng-icon]:shrink-0`,
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent',
'data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground',
'after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100',
]);
}
}
@Directive({
selector: '[hlmTabs],hlm-tabs',
exportAs: 'hlmTabs',
hostDirectives: [
{
directive: BrnTabs,
inputs: ['orientation', 'activationMode', 'brnTabs: tab'],
outputs: ['tabActivated'],
},
],
host: {
'data-slot': 'tabs',
},
})
export class HlmTabs {
public readonly tab = input.required<string>();
constructor() {
classes(() => 'group/tabs flex gap-2 data-[orientation=horizontal]:flex-col');
}
}
export const HlmTabsImports = [
HlmTabs,
HlmTabsList,
HlmTabsTrigger,
HlmTabsContent,
HlmTabsContentLazy,
HlmTabsPaginatedList,
] as const;import { BrnTabs, BrnTabsContent, BrnTabsContentLazy, BrnTabsList, BrnTabsPaginatedList, BrnTabsTrigger, type BrnPaginatedTabHeaderItem } from '@spartan-ng/brain/tabs';
import { CdkObserveContent } from '@angular/cdk/observers';
import { ChangeDetectionStrategy, Component, Directive, computed, contentChildren, input, viewChild, type ElementRef } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { buttonVariants } from '@spartan-ng/helm/button';
import { classes, hlm } from '@spartan-ng/helm/utils';
import { cva, type VariantProps } from 'class-variance-authority';
import { lucideChevronLeft, lucideChevronRight } from '@ng-icons/lucide';
import { toObservable } from '@angular/core/rxjs-interop';
import { type ClassValue } from 'cn';
import { type Observable } from 'rxjs';
@Directive({
selector: 'ng-template[hlmTabsContentLazy]',
exportAs: 'hlmTabsContentLazy',
hostDirectives: [BrnTabsContentLazy],
})
export class HlmTabsContentLazy {}
@Directive({
selector: '[hlmTabsContent]',
exportAs: 'hlmTabsContent',
hostDirectives: [{ directive: BrnTabsContent, inputs: ['brnTabsContent: hlmTabsContent'] }],
host: {
'data-slot': 'tabs-content',
},
})
export class HlmTabsContent {
public readonly contentFor = input.required<string>({ alias: 'hlmTabsContent' });
constructor() {
classes(() => 'flex-1 text-sm outline-none');
}
}
export const listVariants = cva(
'rounded-lg p-[3px] group-data-horizontal/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col',
{
variants: {
variant: {
default: 'bg-muted',
line: 'gap-1 bg-transparent',
},
},
defaultVariants: {
variant: 'default',
},
},
);
type ListVariants = VariantProps<typeof listVariants>;
@Directive({
selector: '[hlmTabsList],hlm-tabs-list',
exportAs: 'hlmTabsList',
hostDirectives: [BrnTabsList],
host: {
'data-slot': 'tabs-list',
'[attr.data-variant]': 'variant()',
},
})
export class HlmTabsList {
public readonly variant = input<ListVariants['variant']>('default');
constructor() {
classes(() => listVariants({ variant: this.variant() }));
}
}
@Component({
selector: 'hlm-paginated-tabs-list',
exportAs: 'hlmTabsPaginatedList',
imports: [CdkObserveContent, NgIcon],
providers: [provideIcons({ lucideChevronRight, lucideChevronLeft })],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'data-slot': 'tabs-paginated-list',
},
template: `
<button
#previousPaginator
data-pagination="previous"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollBefore || null"
(click)="_handlePaginatorClick('before')"
(mousedown)="_handlePaginatorPress('before', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronLeft" />
</button>
<div #tabListContainer class="z-[1] flex grow overflow-hidden" (keydown)="_handleKeydown($event)">
<div class="relative grow transition-transform" #tabList role="tablist" (cdkObserveContent)="_onContentChanges()">
<div #tabListInner [class]="_tabListClass()">
<ng-content />
</div>
</div>
</div>
<button
#nextPaginator
data-pagination="next"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollAfter || null"
(click)="_handlePaginatorClick('after')"
(mousedown)="_handlePaginatorPress('after', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronRight" />
</button>
`,
})
export class HlmTabsPaginatedList extends BrnTabsPaginatedList {
constructor() {
super();
classes(() => 'relative flex flex-shrink-0 items-center gap-1 overflow-hidden');
}
public readonly items = contentChildren(BrnTabsTrigger, { descendants: false });
/** Explicitly annotating type to avoid non-portable inferred type */
public readonly itemsChanges: Observable<ReadonlyArray<BrnPaginatedTabHeaderItem>> = toObservable(this.items);
public readonly tabListContainer = viewChild.required<ElementRef<HTMLElement>>('tabListContainer');
public readonly tabList = viewChild.required<ElementRef<HTMLElement>>('tabList');
public readonly tabListInner = viewChild.required<ElementRef<HTMLElement>>('tabListInner');
public readonly nextPaginator = viewChild.required<ElementRef<HTMLElement>>('nextPaginator');
public readonly previousPaginator = viewChild.required<ElementRef<HTMLElement>>('previousPaginator');
public readonly tabListClass = input<ClassValue>('', { alias: 'tabListClass' });
protected readonly _tabListClass = computed(() => hlm(listVariants(), this.tabListClass()));
public readonly paginationButtonClass = input<ClassValue>('');
protected readonly _paginationButtonClass = computed(() =>
hlm(
'relative z-[2] select-none disabled:cursor-default',
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
this.paginationButtonClass(),
this.showPaginationControls() ? 'inline-flex' : 'hidden',
),
);
protected _itemSelected(_event: KeyboardEvent) {
/* noop - the native button activation selects the focused tab */
}
}
@Directive({
selector: '[hlmTabsTrigger]',
exportAs: 'hlmTabsTrigger',
hostDirectives: [{ directive: BrnTabsTrigger, inputs: ['brnTabsTrigger: hlmTabsTrigger', 'disabled'] }],
host: {
'data-slot': 'tabs-trigger',
},
})
export class HlmTabsTrigger {
public readonly triggerFor = input.required<string>({ alias: 'hlmTabsTrigger' });
constructor() {
classes(() => [
`gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_ng-icon:not([class*='text-'])]:text-[length:--spacing(4)] focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_ng-icon]:pointer-events-none [&_ng-icon]:shrink-0`,
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent',
'data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground',
'after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100',
]);
}
}
@Directive({
selector: '[hlmTabs],hlm-tabs',
exportAs: 'hlmTabs',
hostDirectives: [
{
directive: BrnTabs,
inputs: ['orientation', 'activationMode', 'brnTabs: tab'],
outputs: ['tabActivated'],
},
],
host: {
'data-slot': 'tabs',
},
})
export class HlmTabs {
public readonly tab = input.required<string>();
constructor() {
classes(() => 'group/tabs flex gap-2 data-[orientation=horizontal]:flex-col');
}
}
export const HlmTabsImports = [
HlmTabs,
HlmTabsList,
HlmTabsTrigger,
HlmTabsContent,
HlmTabsContentLazy,
HlmTabsPaginatedList,
] as const;import { BrnTabs, BrnTabsContent, BrnTabsContentLazy, BrnTabsList, BrnTabsPaginatedList, BrnTabsTrigger, type BrnPaginatedTabHeaderItem } from '@spartan-ng/brain/tabs';
import { CdkObserveContent } from '@angular/cdk/observers';
import { ChangeDetectionStrategy, Component, Directive, computed, contentChildren, input, viewChild, type ElementRef } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { buttonVariants } from '@spartan-ng/helm/button';
import { classes, hlm } from '@spartan-ng/helm/utils';
import { cva, type VariantProps } from 'class-variance-authority';
import { lucideChevronLeft, lucideChevronRight } from '@ng-icons/lucide';
import { toObservable } from '@angular/core/rxjs-interop';
import { type ClassValue } from 'cn';
import { type Observable } from 'rxjs';
@Directive({
selector: 'ng-template[hlmTabsContentLazy]',
exportAs: 'hlmTabsContentLazy',
hostDirectives: [BrnTabsContentLazy],
})
export class HlmTabsContentLazy {}
@Directive({
selector: '[hlmTabsContent]',
exportAs: 'hlmTabsContent',
hostDirectives: [{ directive: BrnTabsContent, inputs: ['brnTabsContent: hlmTabsContent'] }],
host: {
'data-slot': 'tabs-content',
},
})
export class HlmTabsContent {
public readonly contentFor = input.required<string>({ alias: 'hlmTabsContent' });
constructor() {
classes(() => 'flex-1 text-sm outline-none');
}
}
export const listVariants = cva(
'rounded-none p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col',
{
variants: {
variant: {
default: 'bg-muted',
line: 'gap-1 bg-transparent',
},
},
defaultVariants: {
variant: 'default',
},
},
);
type ListVariants = VariantProps<typeof listVariants>;
@Directive({
selector: '[hlmTabsList],hlm-tabs-list',
exportAs: 'hlmTabsList',
hostDirectives: [BrnTabsList],
host: {
'data-slot': 'tabs-list',
'[attr.data-variant]': 'variant()',
},
})
export class HlmTabsList {
public readonly variant = input<ListVariants['variant']>('default');
constructor() {
classes(() => listVariants({ variant: this.variant() }));
}
}
@Component({
selector: 'hlm-paginated-tabs-list',
exportAs: 'hlmTabsPaginatedList',
imports: [CdkObserveContent, NgIcon],
providers: [provideIcons({ lucideChevronRight, lucideChevronLeft })],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'data-slot': 'tabs-paginated-list',
},
template: `
<button
#previousPaginator
data-pagination="previous"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollBefore || null"
(click)="_handlePaginatorClick('before')"
(mousedown)="_handlePaginatorPress('before', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronLeft" />
</button>
<div #tabListContainer class="z-[1] flex grow overflow-hidden" (keydown)="_handleKeydown($event)">
<div class="relative grow transition-transform" #tabList role="tablist" (cdkObserveContent)="_onContentChanges()">
<div #tabListInner [class]="_tabListClass()">
<ng-content />
</div>
</div>
</div>
<button
#nextPaginator
data-pagination="next"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollAfter || null"
(click)="_handlePaginatorClick('after')"
(mousedown)="_handlePaginatorPress('after', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronRight" />
</button>
`,
})
export class HlmTabsPaginatedList extends BrnTabsPaginatedList {
constructor() {
super();
classes(() => 'relative flex flex-shrink-0 items-center gap-1 overflow-hidden');
}
public readonly items = contentChildren(BrnTabsTrigger, { descendants: false });
/** Explicitly annotating type to avoid non-portable inferred type */
public readonly itemsChanges: Observable<ReadonlyArray<BrnPaginatedTabHeaderItem>> = toObservable(this.items);
public readonly tabListContainer = viewChild.required<ElementRef<HTMLElement>>('tabListContainer');
public readonly tabList = viewChild.required<ElementRef<HTMLElement>>('tabList');
public readonly tabListInner = viewChild.required<ElementRef<HTMLElement>>('tabListInner');
public readonly nextPaginator = viewChild.required<ElementRef<HTMLElement>>('nextPaginator');
public readonly previousPaginator = viewChild.required<ElementRef<HTMLElement>>('previousPaginator');
public readonly tabListClass = input<ClassValue>('', { alias: 'tabListClass' });
protected readonly _tabListClass = computed(() => hlm(listVariants(), this.tabListClass()));
public readonly paginationButtonClass = input<ClassValue>('');
protected readonly _paginationButtonClass = computed(() =>
hlm(
'relative z-[2] select-none disabled:cursor-default',
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
this.paginationButtonClass(),
this.showPaginationControls() ? 'inline-flex' : 'hidden',
),
);
protected _itemSelected(_event: KeyboardEvent) {
/* noop - the native button activation selects the focused tab */
}
}
@Directive({
selector: '[hlmTabsTrigger]',
exportAs: 'hlmTabsTrigger',
hostDirectives: [{ directive: BrnTabsTrigger, inputs: ['brnTabsTrigger: hlmTabsTrigger', 'disabled'] }],
host: {
'data-slot': 'tabs-trigger',
},
})
export class HlmTabsTrigger {
public readonly triggerFor = input.required<string>({ alias: 'hlmTabsTrigger' });
constructor() {
classes(() => [
`gap-1.5 rounded-none border border-transparent px-1.5 py-0.5 text-xs font-medium group-data-vertical/tabs:py-[calc(--spacing(1.25))] [&_ng-icon:not([class*='text-'])]:text-[length:--spacing(4)] focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_ng-icon]:pointer-events-none [&_ng-icon]:shrink-0`,
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent',
'data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground',
'after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100',
]);
}
}
@Directive({
selector: '[hlmTabs],hlm-tabs',
exportAs: 'hlmTabs',
hostDirectives: [
{
directive: BrnTabs,
inputs: ['orientation', 'activationMode', 'brnTabs: tab'],
outputs: ['tabActivated'],
},
],
host: {
'data-slot': 'tabs',
},
})
export class HlmTabs {
public readonly tab = input.required<string>();
constructor() {
classes(() => 'group/tabs flex gap-2 data-[orientation=horizontal]:flex-col');
}
}
export const HlmTabsImports = [
HlmTabs,
HlmTabsList,
HlmTabsTrigger,
HlmTabsContent,
HlmTabsContentLazy,
HlmTabsPaginatedList,
] as const;import { BrnTabs, BrnTabsContent, BrnTabsContentLazy, BrnTabsList, BrnTabsPaginatedList, BrnTabsTrigger, type BrnPaginatedTabHeaderItem } from '@spartan-ng/brain/tabs';
import { CdkObserveContent } from '@angular/cdk/observers';
import { ChangeDetectionStrategy, Component, Directive, computed, contentChildren, input, viewChild, type ElementRef } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { buttonVariants } from '@spartan-ng/helm/button';
import { classes, hlm } from '@spartan-ng/helm/utils';
import { cva, type VariantProps } from 'class-variance-authority';
import { lucideChevronLeft, lucideChevronRight } from '@ng-icons/lucide';
import { toObservable } from '@angular/core/rxjs-interop';
import { type ClassValue } from 'cn';
import { type Observable } from 'rxjs';
@Directive({
selector: 'ng-template[hlmTabsContentLazy]',
exportAs: 'hlmTabsContentLazy',
hostDirectives: [BrnTabsContentLazy],
})
export class HlmTabsContentLazy {}
@Directive({
selector: '[hlmTabsContent]',
exportAs: 'hlmTabsContent',
hostDirectives: [{ directive: BrnTabsContent, inputs: ['brnTabsContent: hlmTabsContent'] }],
host: {
'data-slot': 'tabs-content',
},
})
export class HlmTabsContent {
public readonly contentFor = input.required<string>({ alias: 'hlmTabsContent' });
constructor() {
classes(() => 'flex-1 text-sm outline-none');
}
}
export const listVariants = cva(
'rounded-4xl p-[3px] group-data-horizontal/tabs:h-9 group-data-vertical/tabs:rounded-2xl data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col',
{
variants: {
variant: {
default: 'bg-muted',
line: 'gap-1 bg-transparent',
},
},
defaultVariants: {
variant: 'default',
},
},
);
type ListVariants = VariantProps<typeof listVariants>;
@Directive({
selector: '[hlmTabsList],hlm-tabs-list',
exportAs: 'hlmTabsList',
hostDirectives: [BrnTabsList],
host: {
'data-slot': 'tabs-list',
'[attr.data-variant]': 'variant()',
},
})
export class HlmTabsList {
public readonly variant = input<ListVariants['variant']>('default');
constructor() {
classes(() => listVariants({ variant: this.variant() }));
}
}
@Component({
selector: 'hlm-paginated-tabs-list',
exportAs: 'hlmTabsPaginatedList',
imports: [CdkObserveContent, NgIcon],
providers: [provideIcons({ lucideChevronRight, lucideChevronLeft })],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'data-slot': 'tabs-paginated-list',
},
template: `
<button
#previousPaginator
data-pagination="previous"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollBefore || null"
(click)="_handlePaginatorClick('before')"
(mousedown)="_handlePaginatorPress('before', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronLeft" />
</button>
<div #tabListContainer class="z-[1] flex grow overflow-hidden" (keydown)="_handleKeydown($event)">
<div class="relative grow transition-transform" #tabList role="tablist" (cdkObserveContent)="_onContentChanges()">
<div #tabListInner [class]="_tabListClass()">
<ng-content />
</div>
</div>
</div>
<button
#nextPaginator
data-pagination="next"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollAfter || null"
(click)="_handlePaginatorClick('after')"
(mousedown)="_handlePaginatorPress('after', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronRight" />
</button>
`,
})
export class HlmTabsPaginatedList extends BrnTabsPaginatedList {
constructor() {
super();
classes(() => 'relative flex flex-shrink-0 items-center gap-1 overflow-hidden');
}
public readonly items = contentChildren(BrnTabsTrigger, { descendants: false });
/** Explicitly annotating type to avoid non-portable inferred type */
public readonly itemsChanges: Observable<ReadonlyArray<BrnPaginatedTabHeaderItem>> = toObservable(this.items);
public readonly tabListContainer = viewChild.required<ElementRef<HTMLElement>>('tabListContainer');
public readonly tabList = viewChild.required<ElementRef<HTMLElement>>('tabList');
public readonly tabListInner = viewChild.required<ElementRef<HTMLElement>>('tabListInner');
public readonly nextPaginator = viewChild.required<ElementRef<HTMLElement>>('nextPaginator');
public readonly previousPaginator = viewChild.required<ElementRef<HTMLElement>>('previousPaginator');
public readonly tabListClass = input<ClassValue>('', { alias: 'tabListClass' });
protected readonly _tabListClass = computed(() => hlm(listVariants(), this.tabListClass()));
public readonly paginationButtonClass = input<ClassValue>('');
protected readonly _paginationButtonClass = computed(() =>
hlm(
'relative z-[2] select-none disabled:cursor-default',
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
this.paginationButtonClass(),
this.showPaginationControls() ? 'inline-flex' : 'hidden',
),
);
protected _itemSelected(_event: KeyboardEvent) {
/* noop - the native button activation selects the focused tab */
}
}
@Directive({
selector: '[hlmTabsTrigger]',
exportAs: 'hlmTabsTrigger',
hostDirectives: [{ directive: BrnTabsTrigger, inputs: ['brnTabsTrigger: hlmTabsTrigger', 'disabled'] }],
host: {
'data-slot': 'tabs-trigger',
},
})
export class HlmTabsTrigger {
public readonly triggerFor = input.required<string>({ alias: 'hlmTabsTrigger' });
constructor() {
classes(() => [
`gap-1.5 rounded-xl border border-transparent px-2 py-1 text-sm font-medium group-data-vertical/tabs:px-2.5 group-data-vertical/tabs:py-1.5 [&_ng-icon:not([class*='text-'])]:text-[length:--spacing(4)] focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_ng-icon]:pointer-events-none [&_ng-icon]:shrink-0`,
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent',
'data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground',
'after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100',
]);
}
}
@Directive({
selector: '[hlmTabs],hlm-tabs',
exportAs: 'hlmTabs',
hostDirectives: [
{
directive: BrnTabs,
inputs: ['orientation', 'activationMode', 'brnTabs: tab'],
outputs: ['tabActivated'],
},
],
host: {
'data-slot': 'tabs',
},
})
export class HlmTabs {
public readonly tab = input.required<string>();
constructor() {
classes(() => 'group/tabs flex gap-2 data-[orientation=horizontal]:flex-col');
}
}
export const HlmTabsImports = [
HlmTabs,
HlmTabsList,
HlmTabsTrigger,
HlmTabsContent,
HlmTabsContentLazy,
HlmTabsPaginatedList,
] as const;import { BrnTabs, BrnTabsContent, BrnTabsContentLazy, BrnTabsList, BrnTabsPaginatedList, BrnTabsTrigger, type BrnPaginatedTabHeaderItem } from '@spartan-ng/brain/tabs';
import { CdkObserveContent } from '@angular/cdk/observers';
import { ChangeDetectionStrategy, Component, Directive, computed, contentChildren, input, viewChild, type ElementRef } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { buttonVariants } from '@spartan-ng/helm/button';
import { classes, hlm } from '@spartan-ng/helm/utils';
import { cva, type VariantProps } from 'class-variance-authority';
import { lucideChevronLeft, lucideChevronRight } from '@ng-icons/lucide';
import { toObservable } from '@angular/core/rxjs-interop';
import { type ClassValue } from 'cn';
import { type Observable } from 'rxjs';
@Directive({
selector: 'ng-template[hlmTabsContentLazy]',
exportAs: 'hlmTabsContentLazy',
hostDirectives: [BrnTabsContentLazy],
})
export class HlmTabsContentLazy {}
@Directive({
selector: '[hlmTabsContent]',
exportAs: 'hlmTabsContent',
hostDirectives: [{ directive: BrnTabsContent, inputs: ['brnTabsContent: hlmTabsContent'] }],
host: {
'data-slot': 'tabs-content',
},
})
export class HlmTabsContent {
public readonly contentFor = input.required<string>({ alias: 'hlmTabsContent' });
constructor() {
classes(() => 'flex-1 text-sm outline-none');
}
}
export const listVariants = cva(
'rounded-lg p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col',
{
variants: {
variant: {
default: 'bg-muted',
line: 'gap-1 bg-transparent',
},
},
defaultVariants: {
variant: 'default',
},
},
);
type ListVariants = VariantProps<typeof listVariants>;
@Directive({
selector: '[hlmTabsList],hlm-tabs-list',
exportAs: 'hlmTabsList',
hostDirectives: [BrnTabsList],
host: {
'data-slot': 'tabs-list',
'[attr.data-variant]': 'variant()',
},
})
export class HlmTabsList {
public readonly variant = input<ListVariants['variant']>('default');
constructor() {
classes(() => listVariants({ variant: this.variant() }));
}
}
@Component({
selector: 'hlm-paginated-tabs-list',
exportAs: 'hlmTabsPaginatedList',
imports: [CdkObserveContent, NgIcon],
providers: [provideIcons({ lucideChevronRight, lucideChevronLeft })],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'data-slot': 'tabs-paginated-list',
},
template: `
<button
#previousPaginator
data-pagination="previous"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollBefore || null"
(click)="_handlePaginatorClick('before')"
(mousedown)="_handlePaginatorPress('before', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronLeft" />
</button>
<div #tabListContainer class="z-[1] flex grow overflow-hidden" (keydown)="_handleKeydown($event)">
<div class="relative grow transition-transform" #tabList role="tablist" (cdkObserveContent)="_onContentChanges()">
<div #tabListInner [class]="_tabListClass()">
<ng-content />
</div>
</div>
</div>
<button
#nextPaginator
data-pagination="next"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollAfter || null"
(click)="_handlePaginatorClick('after')"
(mousedown)="_handlePaginatorPress('after', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronRight" />
</button>
`,
})
export class HlmTabsPaginatedList extends BrnTabsPaginatedList {
constructor() {
super();
classes(() => 'relative flex flex-shrink-0 items-center gap-1 overflow-hidden');
}
public readonly items = contentChildren(BrnTabsTrigger, { descendants: false });
/** Explicitly annotating type to avoid non-portable inferred type */
public readonly itemsChanges: Observable<ReadonlyArray<BrnPaginatedTabHeaderItem>> = toObservable(this.items);
public readonly tabListContainer = viewChild.required<ElementRef<HTMLElement>>('tabListContainer');
public readonly tabList = viewChild.required<ElementRef<HTMLElement>>('tabList');
public readonly tabListInner = viewChild.required<ElementRef<HTMLElement>>('tabListInner');
public readonly nextPaginator = viewChild.required<ElementRef<HTMLElement>>('nextPaginator');
public readonly previousPaginator = viewChild.required<ElementRef<HTMLElement>>('previousPaginator');
public readonly tabListClass = input<ClassValue>('', { alias: 'tabListClass' });
protected readonly _tabListClass = computed(() => hlm(listVariants(), this.tabListClass()));
public readonly paginationButtonClass = input<ClassValue>('');
protected readonly _paginationButtonClass = computed(() =>
hlm(
'relative z-[2] select-none disabled:cursor-default',
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
this.paginationButtonClass(),
this.showPaginationControls() ? 'inline-flex' : 'hidden',
),
);
protected _itemSelected(_event: KeyboardEvent) {
/* noop - the native button activation selects the focused tab */
}
}
@Directive({
selector: '[hlmTabsTrigger]',
exportAs: 'hlmTabsTrigger',
hostDirectives: [{ directive: BrnTabsTrigger, inputs: ['brnTabsTrigger: hlmTabsTrigger', 'disabled'] }],
host: {
'data-slot': 'tabs-trigger',
},
})
export class HlmTabsTrigger {
public readonly triggerFor = input.required<string>({ alias: 'hlmTabsTrigger' });
constructor() {
classes(() => [
`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium group-data-vertical/tabs:py-[calc(--spacing(1.25))] [&_ng-icon:not([class*='text-'])]:text-[length:--spacing(3.5)] focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_ng-icon]:pointer-events-none [&_ng-icon]:shrink-0`,
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent',
'data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground',
'after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100',
]);
}
}
@Directive({
selector: '[hlmTabs],hlm-tabs',
exportAs: 'hlmTabs',
hostDirectives: [
{
directive: BrnTabs,
inputs: ['orientation', 'activationMode', 'brnTabs: tab'],
outputs: ['tabActivated'],
},
],
host: {
'data-slot': 'tabs',
},
})
export class HlmTabs {
public readonly tab = input.required<string>();
constructor() {
classes(() => 'group/tabs flex gap-2 data-[orientation=horizontal]:flex-col');
}
}
export const HlmTabsImports = [
HlmTabs,
HlmTabsList,
HlmTabsTrigger,
HlmTabsContent,
HlmTabsContentLazy,
HlmTabsPaginatedList,
] as const;import { BrnTabs, BrnTabsContent, BrnTabsContentLazy, BrnTabsList, BrnTabsPaginatedList, BrnTabsTrigger, type BrnPaginatedTabHeaderItem } from '@spartan-ng/brain/tabs';
import { CdkObserveContent } from '@angular/cdk/observers';
import { ChangeDetectionStrategy, Component, Directive, computed, contentChildren, input, viewChild, type ElementRef } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { buttonVariants } from '@spartan-ng/helm/button';
import { classes, hlm } from '@spartan-ng/helm/utils';
import { cva, type VariantProps } from 'class-variance-authority';
import { lucideChevronLeft, lucideChevronRight } from '@ng-icons/lucide';
import { toObservable } from '@angular/core/rxjs-interop';
import { type ClassValue } from 'cn';
import { type Observable } from 'rxjs';
@Directive({
selector: 'ng-template[hlmTabsContentLazy]',
exportAs: 'hlmTabsContentLazy',
hostDirectives: [BrnTabsContentLazy],
})
export class HlmTabsContentLazy {}
@Directive({
selector: '[hlmTabsContent]',
exportAs: 'hlmTabsContent',
hostDirectives: [{ directive: BrnTabsContent, inputs: ['brnTabsContent: hlmTabsContent'] }],
host: {
'data-slot': 'tabs-content',
},
})
export class HlmTabsContent {
public readonly contentFor = input.required<string>({ alias: 'hlmTabsContent' });
constructor() {
classes(() => 'flex-1 text-sm outline-none');
}
}
export const listVariants = cva(
'rounded-full p-1 group-data-horizontal/tabs:h-9 group-data-vertical/tabs:rounded-2xl data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col',
{
variants: {
variant: {
default: 'bg-muted',
line: 'gap-1 bg-transparent',
},
},
defaultVariants: {
variant: 'default',
},
},
);
type ListVariants = VariantProps<typeof listVariants>;
@Directive({
selector: '[hlmTabsList],hlm-tabs-list',
exportAs: 'hlmTabsList',
hostDirectives: [BrnTabsList],
host: {
'data-slot': 'tabs-list',
'[attr.data-variant]': 'variant()',
},
})
export class HlmTabsList {
public readonly variant = input<ListVariants['variant']>('default');
constructor() {
classes(() => listVariants({ variant: this.variant() }));
}
}
@Component({
selector: 'hlm-paginated-tabs-list',
exportAs: 'hlmTabsPaginatedList',
imports: [CdkObserveContent, NgIcon],
providers: [provideIcons({ lucideChevronRight, lucideChevronLeft })],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'data-slot': 'tabs-paginated-list',
},
template: `
<button
#previousPaginator
data-pagination="previous"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollBefore || null"
(click)="_handlePaginatorClick('before')"
(mousedown)="_handlePaginatorPress('before', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronLeft" />
</button>
<div #tabListContainer class="z-[1] flex grow overflow-hidden" (keydown)="_handleKeydown($event)">
<div class="relative grow transition-transform" #tabList role="tablist" (cdkObserveContent)="_onContentChanges()">
<div #tabListInner [class]="_tabListClass()">
<ng-content />
</div>
</div>
</div>
<button
#nextPaginator
data-pagination="next"
type="button"
aria-hidden="true"
tabindex="-1"
[class]="_paginationButtonClass()"
[disabled]="disableScrollAfter || null"
(click)="_handlePaginatorClick('after')"
(mousedown)="_handlePaginatorPress('after', $event)"
(touchend)="_stopInterval()"
>
<ng-icon name="lucideChevronRight" />
</button>
`,
})
export class HlmTabsPaginatedList extends BrnTabsPaginatedList {
constructor() {
super();
classes(() => 'relative flex flex-shrink-0 items-center gap-1 overflow-hidden');
}
public readonly items = contentChildren(BrnTabsTrigger, { descendants: false });
/** Explicitly annotating type to avoid non-portable inferred type */
public readonly itemsChanges: Observable<ReadonlyArray<BrnPaginatedTabHeaderItem>> = toObservable(this.items);
public readonly tabListContainer = viewChild.required<ElementRef<HTMLElement>>('tabListContainer');
public readonly tabList = viewChild.required<ElementRef<HTMLElement>>('tabList');
public readonly tabListInner = viewChild.required<ElementRef<HTMLElement>>('tabListInner');
public readonly nextPaginator = viewChild.required<ElementRef<HTMLElement>>('nextPaginator');
public readonly previousPaginator = viewChild.required<ElementRef<HTMLElement>>('previousPaginator');
public readonly tabListClass = input<ClassValue>('', { alias: 'tabListClass' });
protected readonly _tabListClass = computed(() => hlm(listVariants(), this.tabListClass()));
public readonly paginationButtonClass = input<ClassValue>('');
protected readonly _paginationButtonClass = computed(() =>
hlm(
'relative z-[2] select-none disabled:cursor-default',
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
this.paginationButtonClass(),
this.showPaginationControls() ? 'inline-flex' : 'hidden',
),
);
protected _itemSelected(_event: KeyboardEvent) {
/* noop - the native button activation selects the focused tab */
}
}
@Directive({
selector: '[hlmTabsTrigger]',
exportAs: 'hlmTabsTrigger',
hostDirectives: [{ directive: BrnTabsTrigger, inputs: ['brnTabsTrigger: hlmTabsTrigger', 'disabled'] }],
host: {
'data-slot': 'tabs-trigger',
},
})
export class HlmTabsTrigger {
public readonly triggerFor = input.required<string>({ alias: 'hlmTabsTrigger' });
constructor() {
classes(() => [
`gap-2 rounded-full border border-transparent! px-3 py-1 text-sm font-medium group-data-vertical/tabs:rounded-2xl group-data-vertical/tabs:px-3 group-data-vertical/tabs:py-1.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2 [&_ng-icon:not([class*='text-'])]:text-[length:--spacing(4)] focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_ng-icon]:pointer-events-none [&_ng-icon]:shrink-0`,
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent',
'data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground',
'after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100',
]);
}
}
@Directive({
selector: '[hlmTabs],hlm-tabs',
exportAs: 'hlmTabs',
hostDirectives: [
{
directive: BrnTabs,
inputs: ['orientation', 'activationMode', 'brnTabs: tab'],
outputs: ['tabActivated'],
},
],
host: {
'data-slot': 'tabs',
},
})
export class HlmTabs {
public readonly tab = input.required<string>();
constructor() {
classes(() => 'group/tabs flex gap-2 data-[orientation=horizontal]:flex-col');
}
}
export const HlmTabsImports = [
HlmTabs,
HlmTabsList,
HlmTabsTrigger,
HlmTabsContent,
HlmTabsContentLazy,
HlmTabsPaginatedList,
] as const;Usage
import { HlmTabsImports } from '@spartan-ng/helm/tabs';<hlm-tabs tab="account" class="w-full">
<hlm-tabs-list class="grid w-full grid-cols-2" aria-label="tabs example">
<button hlmTabsTrigger="account">Account</button>
<button hlmTabsTrigger="password">Password</button>
</hlm-tabs-list>
<div hlmTabsContent="account">Make your account here</div>
<div hlmTabsContent="password">Change your password here</div>
</hlm-tabs>Examples
Vertical
Account
Make changes to your account here. Click save when you're done.
Password
Change your password here. After saving, you'll be logged out.
Delete Account
Are you sure you want to delete your account? You cannot undo this action.
import { Component } from '@angular/core';
import { HlmButtonImports } from '@spartan-ng/helm/button';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmInputImports } from '@spartan-ng/helm/input';
import { HlmLabelImports } from '@spartan-ng/helm/label';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-vertical',
imports: [HlmTabsImports, HlmCardImports, HlmLabelImports, HlmInputImports, HlmButtonImports],
host: {
class: 'block w-full max-w-lg min-h-[400px]',
},
template: `
<hlm-tabs tab="account" class="mx-auto flex max-w-3xl flex-row space-x-2" orientation="vertical">
<hlm-tabs-list aria-label="tabs example">
<button class="w-full" hlmTabsTrigger="account">Account</button>
<button class="w-full" hlmTabsTrigger="password">Password</button>
<button class="w-full" hlmTabsTrigger="danger">Danger Zone</button>
</hlm-tabs-list>
<div hlmTabsContent="account">
<section hlmCard>
<div hlmCardHeader>
<h3 hlmCardTitle>Account</h3>
<p hlmCardDescription>Make changes to your account here. Click save when you're done.</p>
</div>
<p hlmCardContent>
<label class="my-4 block" hlmLabel>
Name
<input class="mt-1.5 w-full" value="Pedro Duarte" hlmInput />
</label>
<label class="my-4 block" hlmLabel>
Username
<input class="mt-1.5 w-full" placeholder="@peduarte" hlmInput />
</label>
</p>
<div hlmCardFooter>
<button hlmBtn>Save Changes</button>
</div>
</section>
</div>
<div hlmTabsContent="password">
<section hlmCard>
<div hlmCardHeader>
<h3 hlmCardTitle>Password</h3>
<p hlmCardDescription>Change your password here. After saving, you'll be logged out.</p>
</div>
<p hlmCardContent>
<label class="my-4 block" hlmLabel>
Old Password
<input class="mt-1.5 w-full" type="password" hlmInput />
</label>
<label class="my-4 block" hlmLabel>
New Password
<input class="mt-1.5 w-full" type="password" hlmInput />
</label>
</p>
<div hlmCardFooter>
<button hlmBtn>Save Password</button>
</div>
</section>
</div>
<div hlmTabsContent="danger">
<section hlmCard>
<div hlmCardHeader>
<h3 hlmCardTitle>Delete Account</h3>
<p hlmCardDescription>Are you sure you want to delete your account? You cannot undo this action.</p>
</div>
<div hlmCardFooter>
<button variant="destructive" hlmBtn>Delete Account</button>
</div>
</section>
</div>
</hlm-tabs>
`,
})
export class TabsVerticalPreview {}Basic
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-basic',
imports: [HlmTabsImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<hlm-tabs tab="home">
<hlm-tabs-list>
<button hlmTabsTrigger="home">Home</button>
<button hlmTabsTrigger="settings">Settings</button>
</hlm-tabs-list>
</hlm-tabs>
`,
})
export class TabsBasicPreview {}Line
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-line',
imports: [HlmTabsImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<hlm-tabs tab="home">
<hlm-tabs-list variant="line">
<button hlmTabsTrigger="home">Home</button>
<button hlmTabsTrigger="settings">Settings</button>
</hlm-tabs-list>
</hlm-tabs>
`,
})
export class TabsLinePreview {}With Icons
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { lucideAppWindow, lucideCode } from '@ng-icons/lucide';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-with-icons',
imports: [HlmTabsImports, NgIcon],
providers: [provideIcons({ lucideAppWindow, lucideCode })],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<hlm-tabs tab="preview">
<hlm-tabs-list>
<button hlmTabsTrigger="preview">
<ng-icon name="lucideAppWindow" />
Preview
</button>
<button hlmTabsTrigger="code">
<ng-icon name="lucideCode" />
Code
</button>
</hlm-tabs-list>
</hlm-tabs>
`,
})
export class TabsWithIconsPreview {}Icons Only
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { lucideHome, lucideSearch, lucideSettings } from '@ng-icons/lucide';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-icons-only',
imports: [HlmTabsImports, NgIcon],
providers: [provideIcons({ lucideHome, lucideSearch, lucideSettings })],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<hlm-tabs tab="home">
<hlm-tabs-list>
<button hlmTabsTrigger="home">
<ng-icon name="lucideHome" />
</button>
<button hlmTabsTrigger="search">
<ng-icon name="lucideSearch" />
</button>
<button hlmTabsTrigger="settings">
<ng-icon name="lucideSettings" />
</button>
</hlm-tabs-list>
</hlm-tabs>
`,
})
export class TabsIconsOnlyPreview {}With Input and Button
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmButtonImports } from '@spartan-ng/helm/button';
import { HlmInputImports } from '@spartan-ng/helm/input';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-input-button',
imports: [HlmTabsImports, HlmInputImports, HlmButtonImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<hlm-tabs tab="overview">
<div class="flex items-center gap-4">
<hlm-tabs-list>
<button hlmTabsTrigger="overview">Overview</button>
<button hlmTabsTrigger="analytics">Settings</button>
</hlm-tabs-list>
<div class="ml-auto flex items-center gap-2">
<input hlmInput placeholder="Search..." />
<button hlmBtn>Action</button>
</div>
</div>
<div hlmTabsContent="overview" class="rounded-lg border p-6">
View your dashboard metrics and key performance indicators.
</div>
<div hlmTabsContent="analytics" class="rounded-lg border p-6">
Detailed analytics and insights about your data.
</div>
</hlm-tabs>
`,
})
export class TabsInputButtonPreview {}Lazy Loading
Use hlmTabsContentLazy on an ng-template inside a tab panel to keep its content out of the DOM until the user navigates to that tab. This is particularly useful when panels trigger network requests or render expensive component trees. The content is created once on first visit and remains alive for subsequent visits.
Account
This content was lazily loaded when the tab was first activated.
Account content loaded lazily.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-lazy',
imports: [HlmTabsImports, HlmCardImports],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'block w-full max-w-lg',
},
template: `
<hlm-tabs tab="account" class="w-full">
<hlm-tabs-list>
<button hlmTabsTrigger="account">Account</button>
<button hlmTabsTrigger="password">Password</button>
</hlm-tabs-list>
<div hlmTabsContent="account">
<ng-template hlmTabsContentLazy>
<section hlmCard>
<div hlmCardHeader>
<h3 hlmCardTitle>Account</h3>
<p hlmCardDescription>This content was lazily loaded when the tab was first activated.</p>
</div>
<p hlmCardContent>Account content loaded lazily.</p>
</section>
</ng-template>
</div>
<div hlmTabsContent="password">
<ng-template hlmTabsContentLazy>
<section hlmCard>
<div hlmCardHeader>
<h3 hlmCardTitle>Password</h3>
<p hlmCardDescription>This content was lazily loaded when the tab was first activated.</p>
</div>
<p hlmCardContent>Password content loaded lazily.</p>
</section>
</ng-template>
</div>
</hlm-tabs>
`,
})
export class TabsLazyPreview {}Paginated Tabs
Use hlm-paginated-tabs-list instead of hlm-tabs-list for paginated tabs list with next and previous buttons.
Disable pagination with [disablePagination]="true" . Hides the pagination buttons and active tab is not scrolled into view.
Padding styles, applied to the tab list ( listVariants ), are not taken into account during keyboard scrolling . This affects the active tab's scrolling position and next/previous button remain enabled even when the active tab is at the start or end of the tab list.
import { Component, input } from '@angular/core';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-paginated',
imports: [HlmTabsImports],
host: {
class: 'block w-full max-w-lg min-h-[150px]',
},
template: `
<hlm-tabs [tab]="activeTab()" class="w-full">
<hlm-paginated-tabs-list>
@for (tab of lotsOfTabs; track tab) {
<button [hlmTabsTrigger]="tab">{{ tab }}</button>
}
</hlm-paginated-tabs-list>
@for (tab of lotsOfTabs; track tab) {
<div [hlmTabsContent]="tab">{{ tab }}</div>
}
</hlm-tabs>
`,
})
export class TabsPaginatedPreview {
public readonly activeTab = input('Tab 0');
public readonly lotsOfTabs = Array.from({ length: 30 })
.fill(0)
.map((_, index) => `Tab ${index}`);
}RTL
To enable RTL support in spartan-ng, see the RTL configuration guide.
الحساب
قم بإجراء تغييرات على حسابك هنا. انقر على حفظ عند الانتهاء.
كلمة المرور
غيّر كلمة المرور هنا. بعد الحفظ، سيتم تسجيل خروجك.
import { Directionality } from '@angular/cdk/bidi';
import { Component, computed, effect, inject, untracked } from '@angular/core';
import { TranslateService, Translations } from '@spartan-ng/app/app/shared/translate.service';
import { HlmButtonImports } from '@spartan-ng/helm/button';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmInputImports } from '@spartan-ng/helm/input';
import { HlmLabelImports } from '@spartan-ng/helm/label';
import { HlmTabsImports } from '@spartan-ng/helm/tabs';
@Component({
selector: 'spartan-tabs-rtl-preview',
imports: [HlmTabsImports, HlmCardImports, HlmLabelImports, HlmInputImports, HlmButtonImports],
providers: [Directionality],
host: {
class: 'block w-full max-w-lg',
'[dir]': '_dir()',
},
template: `
<hlm-tabs tab="account" class="w-full">
<hlm-tabs-list [attr.aria-label]="_t()['tabsLabel']">
<button hlmTabsTrigger="account">{{ _t()['accountTab'] }}</button>
<button hlmTabsTrigger="password">{{ _t()['passwordTab'] }}</button>
</hlm-tabs-list>
<div hlmTabsContent="account">
<section hlmCard>
<div hlmCardHeader>
<h3 hlmCardTitle>{{ _t()['accountTab'] }}</h3>
<p hlmCardDescription>{{ _t()['accountDescription'] }}</p>
</div>
<p hlmCardContent>
<label class="my-4 block" hlmLabel>
{{ _t()['nameLabel'] }}
<input class="mt-1.5 w-full" value="Pedro Duarte" hlmInput />
</label>
<label class="my-4 block" hlmLabel>
{{ _t()['usernameLabel'] }}
<input class="mt-1.5 w-full" placeholder="@peduarte" hlmInput />
</label>
</p>
<div hlmCardFooter>
<button hlmBtn>{{ _t()['saveChanges'] }}</button>
</div>
</section>
</div>
<div hlmTabsContent="password">
<section hlmCard>
<div hlmCardHeader>
<h3 hlmCardTitle>{{ _t()['passwordTab'] }}</h3>
<p hlmCardDescription>{{ _t()['passwordDescription'] }}</p>
</div>
<p hlmCardContent>
<label class="my-4 block" hlmLabel>
{{ _t()['oldPasswordLabel'] }}
<input class="mt-1.5 w-full" type="password" hlmInput />
</label>
<label class="my-4 block" hlmLabel>
{{ _t()['newPasswordLabel'] }}
<input class="mt-1.5 w-full" type="password" hlmInput />
</label>
</p>
<div hlmCardFooter>
<button hlmBtn>{{ _t()['savePassword'] }}</button>
</div>
</section>
</div>
</hlm-tabs>
`,
})
export class TabsRtlPreview {
private readonly _directionality = inject(Directionality);
private readonly _language = inject(TranslateService).language;
private readonly _translations: Translations = {
en: {
dir: 'ltr',
values: {
tabsLabel: 'Account settings',
accountTab: 'Account',
passwordTab: 'Password',
accountDescription: "Make changes to your account here. Click save when you're done.",
passwordDescription: "Change your password here. After saving, you'll be logged out.",
nameLabel: 'Name',
usernameLabel: 'Username',
oldPasswordLabel: 'Old Password',
newPasswordLabel: 'New Password',
saveChanges: 'Save Changes',
savePassword: 'Save Password',
},
},
ar: {
dir: 'rtl',
values: {
tabsLabel: 'إعدادات الحساب',
accountTab: 'الحساب',
passwordTab: 'كلمة المرور',
accountDescription: 'قم بإجراء تغييرات على حسابك هنا. انقر على حفظ عند الانتهاء.',
passwordDescription: 'غيّر كلمة المرور هنا. بعد الحفظ، سيتم تسجيل خروجك.',
nameLabel: 'الاسم',
usernameLabel: 'اسم المستخدم',
oldPasswordLabel: 'كلمة المرور القديمة',
newPasswordLabel: 'كلمة المرور الجديدة',
saveChanges: 'حفظ التغييرات',
savePassword: 'حفظ كلمة المرور',
},
},
he: {
dir: 'rtl',
values: {
tabsLabel: 'הגדרות חשבון',
accountTab: 'חשבון',
passwordTab: 'סיסמה',
accountDescription: 'בצע שינויים בחשבון שלך כאן. לחץ על שמירה בסיום.',
passwordDescription: 'שנה את הסיסמה שלך כאן. לאחר השמירה, תנותק מהמערכת.',
nameLabel: 'שם',
usernameLabel: 'שם משתמש',
oldPasswordLabel: 'סיסמה ישנה',
newPasswordLabel: 'סיסמה חדשה',
saveChanges: 'שמור שינויים',
savePassword: 'שמור סיסמה',
},
},
};
private readonly _translation = computed(() => this._translations[this._language()]);
protected readonly _t = computed(() => this._translation().values);
protected readonly _dir = computed(() => this._translation().dir);
constructor() {
effect(() => {
const dir = this._dir();
untracked(() => this._directionality.valueSignal.set(dir));
});
}
}Brain API
BrnTabsContentLazy
Selector: ng-template[brnTabsContentLazy]
ExportAs: brnTabsContentLazy
BrnTabsContent
Selector: [brnTabsContent]
ExportAs: brnTabsContent
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| brnTabsContent* (required) | string | - | - |
BrnTabsList
Selector: [brnTabsList]
ExportAs: brnTabsList
BrnTabsPaginatedList
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| disablePagination | boolean | false | Whether pagination should be disabled. This can be used to avoid unnecessary layout recalculations if it's known that pagination won't be required. |
Outputs
| Prop | Type | Default | Description |
|---|---|---|---|
| selectFocusedIndex | number | - | Event emitted when the option is selected. |
| indexFocused | number | - | Event emitted when a label is focused. |
BrnTabsTrigger
Selector: button[brnTabsTrigger]
ExportAs: brnTabsTrigger
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| brnTabsTrigger* (required) | string | - | - |
| disabled | boolean | false | - |
BrnTabs
Selector: [brnTabs]
ExportAs: brnTabs
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | BrnTabsOrientation | 'horizontal' | - |
| activationMode | BrnActivationMode | 'automatic' | - |
| brnTabs | string | undefined | undefined | - |
Outputs
| Prop | Type | Default | Description |
|---|---|---|---|
| tabActivated | string | - | - |
| brnTabsChange | string | undefined | undefined | - |
Helm API
HlmTabsContentLazy
Selector: ng-template[hlmTabsContentLazy]
ExportAs: hlmTabsContentLazy
HlmTabsContent
Selector: [hlmTabsContent]
ExportAs: hlmTabsContent
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| hlmTabsContent* (required) | string | - | - |
HlmTabsList
Selector: [hlmTabsList],hlm-tabs-list
ExportAs: hlmTabsList
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | ListVariants['variant'] | 'default' | - |
HlmTabsPaginatedList
Selector: hlm-paginated-tabs-list
ExportAs: hlmTabsPaginatedList
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| tabListClass | ClassValue | '' | - |
| paginationButtonClass | ClassValue | '' | - |
| disablePagination | boolean | false | Whether pagination should be disabled. This can be used to avoid unnecessary layout recalculations if it's known that pagination won't be required. |
Outputs
| Prop | Type | Default | Description |
|---|---|---|---|
| selectFocusedIndex | number | - | Event emitted when the option is selected. |
| indexFocused | number | - | Event emitted when a label is focused. |
HlmTabsTrigger
Selector: [hlmTabsTrigger]
ExportAs: hlmTabsTrigger
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| hlmTabsTrigger* (required) | string | - | - |
| disabled | boolean | false | - |
HlmTabs
Selector: [hlmTabs],hlm-tabs
ExportAs: hlmTabs
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| tab* (required) | string | - | - |
| orientation | BrnTabsOrientation | 'horizontal' | - |
| activationMode | BrnActivationMode | 'automatic' | - |
Outputs
| Prop | Type | Default | Description |
|---|---|---|---|
| tabActivated | string | - | - |
On This Page