0.0.2 • Published 4 years ago

adaptive-tabs v0.0.2

Weekly downloads
5
License
ISC
Repository
github
Last release
4 years ago

npm version

AdaptiveTabs

This library creates a tabs component which adjust automatically based on the screen size and shows overflowing tabs inside a dropdown.

demo

Interface

interface AdaptiveTab {
  title: string;
  id?: string; //optional
  disabled?: boolean //optional
}

Props

PropertyTypeDefaultRequired?Description
tabsAdaptiveTab[]This is list of tabs we want ot render.
activeTabString1st tabThis is the current active Tab
activeTabChangeEventstringEmites the selected tabs id.

Input

tabs: AdaptiveTab[]; // array of tabs to render
activeTab: string // id of the selected tabs

By default 1st tab is selected and. if you don't pass id it will take title as id and render only unique one.

Output

activeTabChangeEvent: string // emits the id of the selected tab

Usage

app.component.html

<ng-adaptive-tabs [tabs]="tabs" (activeTabChangeEvent)="tabChanged($event)">
</ng-adaptive-tabs>

app.component.ts 

tabs: AdaptiveTab = [ { title: 'Tab-1' }, { title: 'Tab-2' }]

public tabChanged(id: stirng) {
    console.log('selected tab id ', id);
}

*Note - Compiled with enableIvy: false

0.0.2

4 years ago

0.0.1

4 years ago