# tabs-component

> A simple tabs component

Latest version **2.0.1** (published 2016-02-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install tabs-component
pnpm add tabs-component
yarn add tabs-component
bun add tabs-component
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2016-02-05 |
| First published | 2015-03-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | korynunn |

## Links

- npm: https://www.npmjs.com/package/tabs-component
- Repository: https://github.com/KoryNunn/tabs-component
- Homepage: https://github.com/KoryNunn/tabs-component#readme
- Issues: https://github.com/KoryNunn/tabs-component/issues
- npm.io page: https://npm.io/package/tabs-component

## Dependencies (5)

- [fastn](https://npm.io/package/fastn.md) ^2.5.2
- [slabs](https://npm.io/package/slabs.md) ^2.0.4
- [doc-js](https://npm.io/package/doc-js.md) ^1.3.1
- [laidout](https://npm.io/package/laidout.md) ^1.0.0
- [defaultcss](https://npm.io/package/defaultcss.md) ^1.1.1

## Recent versions

- 2.0.1 (latest) — 2016-02-05
- 2.0.0 — 2016-02-04
- 1.1.2 — 2015-03-25
- 1.1.0 — 2015-03-24
- 1.0.0 — 2015-03-23

## README

# tabs-component

A simple tabs component

Built with `fastn.js` and `slabs`

# Usage

## Settings

```
{
    tab: int, shown tab index
}
```

## Standalone

```
var createTabsComponent = require('tabs-component');

// Create the tabs
var tabs = createTabsComponent({
        options: ['foo', 'bar', 'baz']
    });

// Watch for changes to the tabs current tab
tabs.tab.on('change', function(value){
    console.log(value);
});

// Put the tabs's element somewhere in the DOM.
document.body.appendChild(tabs.element);

// Add tab contents
tabs.insert(<DOM node> or `fastn` component);
```

## Fastn component

```
var fastn = require('fastn')({
    ... other components...
    tabs: require('tabs-component/tabsComponent')
});

var tabs = fastn('tabs', { options... });
```

## Inserting

```
someDomNode.appendChild(tabs.element);
```

## Properties

### Tab

```
// retrieve value
tabs.tab(); // returns the current tab

// set value
tabs.tab(2); -// sets the current tab, returns tabs.tab property

// watch for changes
tabs.tab.on('change', function(tab){
    // Do something
});
```

### Tabs

```
// retrieve value
tabs.tabs(); // returns the number of tabs

// watch for changes
tabs.tabs.on('change', function(tabs){
    // Do something
});

---
_Source: https://npm.io/package/tabs-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
