[![npm version](https://badge.fury.io/js/orxapi.tools.toggle.svg)](https://badge.fury.io/js/orxapi.tools.toggle.svg)

# orxapi.tools.toggle
The toggle tools library for orxapi. 

## Getting Started

If you haven't used [NodeJs](http://nodejs.org/) before, be sure to have install the LTS version on your desktop ! Check your version with this command:

```shell
node -v
v14.15.0
```

## Installation

```shell
npm install orxapi.tools.toggle --save-dev
```

This library is written in TypeScript, but you can use JavaScript.

## Usage
TypeScript code
```ts
import { toggleLink } from "orxapi.tools.toggle";

// Click event: display the content information
$(".link").on("click.toggleLink", (evt: JQueryEventObject) => {
  const elem = evt.currentTarget;
  toggleLink(elem);
});
```
HTML code
```html
<button class="link" data-toggle-link="contentInformation">More information</button>
<div id="contentInformation" class="content">
  ...
</div>
```

## Methods
- **toggleLink** Toggle link from data id <br>
- **toggleLinks** Toggle links from data id <br>
- **toggleSwitch** Toggle switch between two links <br>
- **toggleText** Toggle text from data text <br>
- **toggleIcon** Toggle switch between two icons data values <br>
- **toggleDisabled** Toggle disable all list element from data disabled

See docs for more information

*This library was designed to work with ES 6+*

### TODO

- [ ] Add tests
- [ ] Improve the documentation