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

kis-tabs

v1.0.1

Published

Easy to use pure js tabs module

Downloads

3

Readme

kis-tabs

Pure js module for tabs.

Installation

Install package using npm install kis-tabs command.

Usage

Create an HTML markup


<div class="tabs">
  <div class="tabs__nav">
    <button class="tabs__nav-btn">Tab 1</button>
    <button class="tabs__nav-btn">Tab 2</button>
    <button class="tabs__nav-btn">Tab 3</button>
  </div>
  <ul class="tabs-inner">
    <li class="tab">
      <p>Tab 1 content</p>
    </li>
    <li class="tab">
      <p>Tab 2 content</p>
    </li>
    <li class="tab">
      <p>Tab 3 content</p>
    </li>
  </ul>
</div>

Import module

import KisTabs from 'kis-tabs';

Create tabs instance

const tabs = new KisTabs({
  tabSelector: '.tab',
  btnSelector: '.tabs__nav-btn',
});

Initialize tabs

tabs.init();

API

Properties

| Name | Type | Default | Description | |-------------------------|--------------------|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | tabSelector required | string | undefined | Css selector for elements with tabs content. | | btnSelector | string | undefined | Css selector for elements used to switch between tabs. | | navSelector | string | undefined | Css selector for navigation element. If can element with selector not found this.nav will be set to first button parent. Used to insert moving background element if this hasMovingBackground sets to true | | activeClass | string | 'js--active' | Class to be added to active tab and button. | | eventType | string | 'click' | Event type will be listened at buttons. | | initialTab | number, string | 0 | Id or name of the tab will be active after tabs initialization. | | hasMovingBackground | boolean | false | If true it will init (and create if it's needed) element with movingBackgroundClass class. It's the element that will be moved to create a visual effect like there. | | movingBackgroundClass | string | 'tabs__background' | Moving background class. | | searchParameterName | string | undefined | If sets on tab change url search parameter searchParameterName will be changed to active tab name. | | tabNameAttribute | string | 'data-tab-name' | Tab element attribute with tab name. |

Methods

| Name | Return | Arguments | Description | |--------------|------------------------|-----------------------------|---------------------------------------------------------------------------------------------------| | init() | Tabs instance | - | Initialize all listeners. | | goTo(id) | Active tab HTMLElement | _id: number or string | If typeof id === 'string' makes tab with name id active. Else makes tab number id active. | | goToNext() | Active tab HTMLElement | - | Makes next tab active. | | goToPrev() | Active tab HTMLElement | - | Makes previous tab active. |

License

MIT

Copyright © 2021 kirillsakun.