Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/carry0987/checkbox-js

A library for create and manage checkbox elements
https://github.com/carry0987/checkbox-js

checkbox typescript

Last synced: 12 days ago
JSON representation

A library for create and manage checkbox elements

Awesome Lists containing this project

README

        

# CheckBox-JS
[![version](https://img.shields.io/npm/v/@carry0987/check-box.svg)](https://www.npmjs.com/package/@carry0987/check-box)
![CI](https://github.com/carry0987/CheckBox-JS/actions/workflows/ci.yml/badge.svg)
A library for create and manage checkbox elements

## Installation
```bash
pnpm i @carry0987/check-box
```

## Usage
Here is a simple example to use CheckBox-JS

#### UMD
```html






Check-1

Check-2

Check-3


let checkBox = new checkBoxjs.CheckBox('#app .check-box-list input', {
bindLabel: true,
checkAll: ['#check-all', '#check-all-2'],
allowShiftKey: true,
onChange: (total, target) => {
console.log(target);
if (target) console.log(target);
},
onCheckAll: (total) => {
console.log(total);
},
styles: {
'#check-all ~ label': {
fontWeight: 'bold'
}
}
});
checkBox.onChange = (total, target) => {
console.log('Total: ', total);
if (target) console.log(target);
};
document.getElementById('version').innerText = checkBoxjs.CheckBox.version;

```

#### ES Module
```ts
import { CheckBox } from '@carry0987/check-box';
import '@carry0987/check-box/theme/checkBox.min.css';

let checkBox = new CheckBox('#app .check-box-list input', {
//...
});
```