All Projects → maximelafarie → ngx-tabset

maximelafarie / ngx-tabset

Licence: MIT license
A very simple library to let you create some tabs

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
SCSS
7915 projects

Projects that are alternatives of or similar to ngx-tabset

alfred-tabs
🔍 Find Chrome/Safari tabs you want easily
Stars: ✭ 13 (-31.58%)
Mutual labels:  tabs, tab
react-context-tabs
Flexible tabs for React
Stars: ✭ 31 (+63.16%)
Mutual labels:  tabs, tab
Fliptabs
Android Flip Tabs Library
Stars: ✭ 135 (+610.53%)
Mutual labels:  tabs, tab
PagerSlidingTabStrip
An interactive indicator to navigate between the different pages of a ViewPager
Stars: ✭ 2,194 (+11447.37%)
Mutual labels:  tabs, tab
Electron Tabs
Simple tabs for Electron applications
Stars: ✭ 350 (+1742.11%)
Mutual labels:  tabs, tab
Docsify Tabs
A docsify.js plugin for rendering tabbed content from markdown
Stars: ✭ 65 (+242.11%)
Mutual labels:  tabs, tab
Hyper Tabs Enhanced
Enhanced Tabs Plugin for Hyper
Stars: ✭ 173 (+810.53%)
Mutual labels:  tabs, tab
storefront
An Angular 2 storefront app for Magento 2 (unmaintained)
Stars: ✭ 35 (+84.21%)
Mutual labels:  angular2
ic-datepicker
Angular (2+) datepicker component
Stars: ✭ 27 (+42.11%)
Mutual labels:  angular2
TubeLister
A handy Chrome extension to collect all your YouTube tabs into one!
Stars: ✭ 19 (+0%)
Mutual labels:  tabs
wui
Collection of GUI widgets for the web
Stars: ✭ 44 (+131.58%)
Mutual labels:  tabs
ng2-events
Supercharge your Angular2+ event handling
Stars: ✭ 17 (-10.53%)
Mutual labels:  angular2
AuthGuard
Example repo for guarding routes post
Stars: ✭ 42 (+121.05%)
Mutual labels:  angular2
leto
Leto: Realtime Application Stack [Angualr2, Rethinkdb/Horizon, ExpressJS] Web | Mobile | Desktop
Stars: ✭ 21 (+10.53%)
Mutual labels:  angular2
ng2-carouselamos
Simple carousel/slider for angular 2.
Stars: ✭ 39 (+105.26%)
Mutual labels:  angular2
perspectiveapi-authorship-demo
Example code to illustrate how to build an authorship experience using the perspective API
Stars: ✭ 62 (+226.32%)
Mutual labels:  angular2
angular-2-admin
An Angular 2 Admin Dashboard built using the Angular-CLI.
Stars: ✭ 65 (+242.11%)
Mutual labels:  angular2
angular-odata-es5
OData Service for Angular.io (es5 version)
Stars: ✭ 45 (+136.84%)
Mutual labels:  angular2
cloud-speech-and-vision-demos
A set of demo applications that make use of google speech, nlp and vision apis based in angular2
Stars: ✭ 35 (+84.21%)
Mutual labels:  angular2
react-native-segment-control
Swipeable SegmentedControl component for React Native apps
Stars: ✭ 21 (+10.53%)
Mutual labels:  tabs

image

Greenkeeper badge Build Status npm version npm downloads codecov

ngx-tabset is a very simple library to let you create some tabs. It uses flex-box and is compatible with Angular >=2.0.0.

Demo

https://maximelafarie.com/ngx-tabset/

This library doesn't use any framework (no CSS library, no JQuery...)

Setup

To use ngx-tabset in your project install it via npm / yarn:

npm i ngx-tabset --save

or

yarn add ngx-tabset

If you are using system.js you may want to add this into your config:

System.config({
    "map": {
        "ngx-tabset": "node_modules/ngx-tabset/bundles/ngx-tabset.umd.js"
    }
});

Usage

Import TabsModule in your app module and start using it in any component:

import {CommonModule} from '@angular/common';
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';

import {AppComponent} from './app.component';
import {TabsModule} from 'ngx-tabset';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    CommonModule,
    TabsModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {
}

And import ngx-tabset.scss or ngx-tabset.css in a global style file (e.g. styles.scss or styles.css in classic Angular projects or any other scss/css file it imports): Example with styles.scss:

/* You can add global styles to this file, and also import other style files */
@import "~ngx-tabset/ngx-tabset";
@import "app/app.component";
...

Demo example here

Basic example

<ngx-tabset customNavClass="nav-test-class" customTabsClass="container">
  <ngx-tab tabTitle="About me" tabSubTitle="a little subtitle">
    Its all about me.
  </ngx-tab>
  <ngx-tab tabTitle="Contacts" tabSubTitle="my contacts" [bypassDOM]="true">
    <ng-template>
      This is content of the contacts tab
    </ng-template>
  </ngx-tab>
  <ngx-tab tabTitle="Map" tabSubTitle="i'm disabled" [disabled]="true">
    Content of the Map Tab
  </ngx-tab>
</ngx-tabset>

Content projection example

<ngx-tabset [disableStyle]="true" (onSelect)="doSomethingOnTabSelect($event)">
    <ngx-tab tabTitle="Tab title" [active]="true" [bypassDOM]="true">
        <ng-template>
          <app-my-component></app-my-component>
        </ng-template>
    </ngx-tab>
    ...
</ngx-tabset>
  • <ngx-tabset> is a container for all tabs
    • [disableStyle]="true|false" Disables/enables the built-in style. It allows you to style the entire tab yourself
    • (onSelect)="doSomethingOnTabSelect($event)" Callback to be called when tab is being selected. It returns the index of the selected tab into tabset collection.
  • <ngx-tab> is a single tab item
    • tabTitle The tab title
    • tabSubTitle The tab subtitle
    • [disabled]="true|false Indicates if current tab is enabled or disabled
    • [active]="true|false" Specifies which tab should be active on init. By default the first tab will be active.

Style

⚠️ For ngx-tabset >= 2.0.0 only! ngx-tabset provides built-in SCSS variables that you can override easily like it (assuming you imported ngx-tabset.scss as explained above):

/* You can add global styles to this file, and also import other style files */
/* NgxTabset variables override */
$active-tab-color: rgba(0, 0, 0, .7);
$nav-tab-padding: 20px;

@import "~ngx-tabset/ngx-tabset";
...

Available SCSS variables

The below documentation will use the following pattern:

parameter/option name (type) | default value | description

  • $active-tab-color (hex / rgb / rgba) | redModifies the border color of the active tab

  • $default-tab-border (border) | solid 1px transparentModifies tab's default border style

  • $nav-tab-padding (px / % / ...) | 10pxDefines the nav tabs padding

  • $disabled-tab-opacity (0 - 1) | .5The nav tab opacity of disabled tabs

  • $tab-cursor (cursor) | pointerDefines the cursor type for tabs that aren't disabled or active.

  • $tab-border-transition-duration (duration) | 200msThe animation duration. You can use any duration unit you want

  • $tab-border-transition-timing-function (transition-timing-function Property) | ease-in-outSpecifies the speed curve of the transition effect (available speed curves here)

Customization options

ngx-tabset comes with several options in order to facilitate integration (with CSS frameworks, custom style, etc.).

The below documentation will use the following pattern:

parameter/option name (type) | default value | required? ― description

  • disableStyle (boolean) | falseEnable / disable default tabset style. E.g.: it's useful if you want to keep the provided style on some tabs and disable it on others

  • bypassDOM (boolean) | falseOption to allow the tab to trigger lifecycle events to the wrapped content, e.g. for wrapped components. You need to surround tab content with <ng-template>...</ng-template> in order to make it work. Please check the above example for full implementation

  • customNavClass (string) | ''All the additionnal classes you want to add to the tabset header / nav. You can add several classes by giving a string with space-separated classnames

  • customTabsClass (string) | ''All the additionnal classes you want to add to the tabset container. You can add several classes by giving a string with space-separated classnames

  • customPaneClass (string) | ''All the additionnal classes you want to add to each tab pane. You can add several classes by giving a string with space-separated classnames

Issues

If you wish to submit an issue, please use the available template to facilitate reading and comprehension of all issues encountered. You can find this template in ./github/issue_template.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].