Skip to content

@memberjunction/ng-tabstrip

A lightweight, zero-dependency Angular tab strip component for MemberJunction applications. Provides dynamic tab management with closeable tabs, scroll overflow handling, context menus, and programmatic tab control.

Terminal window
npm install @memberjunction/ng-tabstrip

The tab strip renders a row of tab headers with corresponding body panels. It handles overflow with horizontal scroll buttons, supports closeable tabs with cancelable close events, and provides a rich event system for tab lifecycle management. Unlike Kendo UI tabs, this component has no external dependencies beyond Angular.

flowchart TD
    subgraph TabStrip["MJTabStripComponent"]
        A["Tab Headers (scrollable)"]
        A --> B["MJTabComponent 1"]
        A --> C["MJTabComponent 2"]
        A --> D["MJTabComponent N"]
    end
    subgraph Bodies["Tab Bodies"]
        E["MJTabBodyComponent 1"]
        F["MJTabBodyComponent 2"]
        G["MJTabBodyComponent N"]
    end
    subgraph Events["Event System"]
        H["BeforeTabSelected (cancelable)"]
        I["TabSelected"]
        J["BeforeTabClosed (cancelable)"]
        K["TabClosed (with done callback)"]
        L["TabContextMenu"]
    end

    B --> E
    C --> F
    D --> G
    TabStrip --> Events

    style TabStrip fill:#2d6a9f,stroke:#1a4971,color:#fff
    style Bodies fill:#2d8659,stroke:#1a5c3a,color:#fff
    style Events fill:#7c5295,stroke:#563a6b,color:#fff
import { MJTabStripModule } from '@memberjunction/ng-tabstrip';
@NgModule({
imports: [MJTabStripModule]
})
export class YourModule {}
<mj-tabstrip
[SelectedTabIndex]="selectedTab"
(TabSelected)="onTabSelected($event)"
(BeforeTabClosed)="onBeforeTabClosed($event)">
<mj-tab [Name]="'overview'" [TabCloseable]="false">Overview</mj-tab>
<mj-tab [Name]="'details'" [TabCloseable]="true">Details</mj-tab>
<mj-tab [Name]="'settings'" [TabCloseable]="true">Settings</mj-tab>
<mj-tab-body>
<h2>Overview Content</h2>
</mj-tab-body>
<mj-tab-body>
<h2>Details Content</h2>
</mj-tab-body>
<mj-tab-body>
<h2>Settings Content</h2>
</mj-tab-body>
</mj-tabstrip>
ComponentSelectorPurpose
MJTabStripComponentmj-tabstripContainer managing tab selection and scroll
MJTabComponentmj-tabIndividual tab header
MJTabBodyComponentmj-tab-bodyContent panel for a tab
PropertyTypeDefaultDescription
SelectedTabIndexnumber0Index of the selected tab
FillWidthbooleantrueFill container width
FillHeightbooleantrueFill container height
ScrollAmountnumber150Pixels to scroll per click
EventTypeDescription
BeforeTabSelectedEventEmitter<TabCancelableEvent>Before tab selection (cancelable)
TabSelectedEventEmitter<TabEvent>After tab selection
BeforeTabClosedEventEmitter<TabCancelableEvent>Before tab close (cancelable)
TabClosedEventEmitter<TabClosedEvent>After tab close (call done() when finished)
TabContextMenuEventEmitter<TabContextMenuEvent>Tab right-click
TabScrolledEventEmitter<void>Tab strip scrolled
MethodReturnsDescription
SelectTabByName(name)MJTabComponent | undefinedSelect a tab by name
GetTabByName(name)MJTabComponent | undefinedFind a tab by name
CloseTab(index)Promise<void>Close a tab programmatically
scrollIntoView(index)voidScroll to make a tab visible
RefreshTabs()voidRefresh after dynamic changes
PropertyTypeDefaultDescription
Namestring''Tab identifier
IDstring | numberCustom identifier
TabCloseablebooleanfalseShow close button
VisiblebooleantrueTab visibility
  • TabEvent{ index, tab, body }
  • TabCancelableEvent — Extends TabEvent with cancel: boolean
  • TabClosedEvent — Extends TabEvent with newTabIndex and done() callback
  • TabContextMenuEvent — Extends TabEvent with mouseEvent