npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ng-ar/tab

v14.0.5

Published

This angular npm library package will help us create tabs with appropriate contents. There is a default style for the tab panel and tab. The interesting part is user also can provide there own template, if they have their own.

Downloads

1

Readme

Angular Tab

This angular npm library package will help us create tabs with appropriate contents. There is a default style for the tab panel and tab. The interesting part is user also can provide there own template, if they have their own.

Demo

Here is how the tabs(default) look like on the screen:

Demo of ng-ar-tab

Installation

This is how to install the components:

npm install @ng-ar/tab

or

yarn add @ng-ar/tab

Minimum angular version needed for this library is v14.0.2.

And on your application module:

import { TabModule } from '@ng-ar/tab';

@NgModule({
  declarations: [ ...],
  imports: [
    BrowserModule,
    ....,
    TabModule
],
})
export class AppModule { }

We can use them as below in HTML view:

<div class="container">
  <ng-ar-tab-panel>
    <ng-ar-tab title="Login">
      <form>
        <div class="form-field">
            <label>Email:</label><input class="login-email">
        </div>
        <div class="form-field">
            <label>Password:</label><input>
        </div>
      </form>
    </ng-ar-tab>

    <ng-ar-tab title="Sign Up">
      <form>
        <div class="form-field">
            <label>Email:</label><input>
        </div>
        <div class="form-field">
            <label>Password:</label><input>
        </div>
        <div class="form-field">
            <label>Confirm Password:</label><input>
        </div>
      </form>
    </ng-ar-tab>

    <ng-ar-tab title="Contact">
      <form>
        <div class="form-field">
            <label>Email:</label><input class="contact-email">
        </div>
        <div class="form-field">
            <label>Message:</label>
            <textarea></textarea>
        </div>
      </form>
    </ng-ar-tab>
  </ng-ar-tab-panel>
</div>

Prop title is used to pass the tab name. If you want to select some tab when loading, you can pass the prop selected and value as true to the particular tab.

General partern as follow:

<ng-ar-tab-panel>
  <ng-ar-tab title="My Title" [selected]="true">
    ... html content
  </ng-ar-tab>
</ng-ar-tab-panel>

You can find the demo project scss as below:

.container {
  margin: 0 auto;
  max-width: 400px;
  padding-top: 1rem;

  & .form-field {
    display: inline-block;
    margin-bottom: 10px;

    & label {
      display: inline-block;
      width: 100px;
      text-align: right;
      margin-right: 5px;
    }

    & input {
      height: 20px;
      border-radius: 2px;
    }

    & input, textarea {
      border: 1px solid grey;
    }
  }
}

We can see how user can provide their own html and style as below:

<div class="container">
  <ng-template #headerButtons>
    <button (click)="tabPanel.onSelectTab(loginTab)" class="btn-test" 
      [ngClass]="{ 'btn-selected': tabPanel.tabSelected?.title === 'Login' }">
      Login
    </button>
    <button (click)="tabPanel.onSelectTab(signupTab)" class="btn-test" 
      [ngClass]="{ 'btn-selected': tabPanel.tabSelected?.title === 'Sign Up' }">
      Sign-Up
    </button>
  </ng-template>

  <ng-ar-tab-panel [headerTemplate]="headerButtons" #tabPanel>
    <ng-ar-tab title="Login" #loginTab>
      <form>
        <div class="form-field">
            <label>Email:</label><input class="login-email">
        </div>
        <div class="form-field">
            <label>Password:</label><input>
        </div>
      </form>
    </ng-ar-tab>

    <ng-ar-tab title="Sign Up" #signupTab>
      <form>
        <div class="form-field">
            <label>Email:</label><input>
        </div>
        <div class="form-field">
            <label>Password:</label><input>
        </div>
        <div class="form-field">
            <label>Confirm Password:</label><input>
        </div>
      </form>
    </ng-ar-tab>
  </ng-ar-tab-panel>
</div>

Prop headerTemplate used to feed template and tabSelected public api object is used to know the currently selected tab. You can define your template with ng-template angulat html tag.

you can find the sample style for the new template as below:

.btn-test{
  display: inline-block;
  color: white;
  background-color: aqua;
  padding: 2px 20px;
  cursor: pointer;
  margin-left: 5px;
  margin-top: 5px;
  border: 1px solid rgb(17, 239, 239);
  border-radius: 4px;

  &:hover {
    background-color: white;
    color: rgb(17, 239, 239);
    border: 1px solid rgb(17, 239, 239);
  }
}

.btn-selected {
  background-color: green;
  border: 1px solid rgb(6, 95, 6);
}

You can find the demo screenshot for the html provided one as below:

Demo of ng-ar-tab with template