# ldtab

> simple tab widget

Latest version **1.0.0** (published 2022-01-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install ldtab
pnpm add ldtab
yarn add ldtab
bun add ldtab
```

## 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 | 1.0.0 |
| Published | 2022-01-19 |
| First published | 2020-12-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.14.1 |
| Dependencies | 0 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | zbryikt |
| Maintainers | tkirby |

## Links

- npm: https://www.npmjs.com/package/ldtab
- Repository: https://github.com/loadingio/ldtab
- Issues: https://github.com/loadingio/ldtab/issues
- npm.io page: https://npm.io/package/ldtab

## Recent versions

- 1.0.0 (latest) — 2022-01-19
- 0.1.0 — 2020-12-18
- 0.0.2 — 2020-12-17
- 0.0.1 — 2020-12-17

## README

# ldtab

simple tab widget.

    div(ldtab-group="main",type="tab")
      div(ldtab="tab1",default) tab1
      div(ldtab="tab2") tab2
    div(ldtab-group="main", type="panel")
      div(ldtab="tab1",default) panel1
      div(ldtab="tab2") panel2


## Usage

include required js and css file, then:

    fd = new ldtab({ ... });

Available options:

 - `root`: root element. ldtab will only handles events / elements under this element.
 - `autoInit`: automatically adding all `ldtab` elements. default true.
   - you will have to add manually when you set `autoInit` to false.
 - `tab`, `panel`: animation options for `tab` and `panel`, both includes following configs:
   - className: default class name. default `ldtab` for tab, `ldtab-panel` for panel.
   - classIn: class name for transition in. default `ldtab-in` for tab, `ldtab-panel-in` for panel.
   - classOut: class name for transition out. default `ldtab-out` for tab, `ldtab-panel-out` for panel.
   - delay: delay ( in ms ) before deactivating tab / panel. default 350
   - deactivate({node}): function called when tab / panel is deactivated. default null.
   - activate({node}): function called when tab / panel is activated. default null.

## Activate / Deactivate Events

With `activate` and `deactivate` callback, you can customize how panel / tab behave when their state changes. However, this means that the default dynamics ( involving `classIn` and `classOut` ) will not work anymore.

Additionally, you need to always toggle `active` class of panel / tab element to provide hints about the state of these elements to ldtab:

    new ldtab
      tab:
        activate: ({node}) -> node.classList.add \active, \d-block
        deactivate: ({node}) -> node.classList.remove \active, \d-block



## License

MIT

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