close
The Wayback Machine - https://web.archive.org/web/20190702153416/https://github.com/github/check-all
Skip to content
Multiple checkbox selection helper.
Branch: master
Clone or download
Latest commit 26882a8 Mar 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Image examples Fix demo page Aug 31, 2018
Image test Update development dependencies Feb 27, 2019
Image .babelrc Update build toolchain to Babel 7.0 Feb 27, 2019
Image .eslintrc.json Initial commit Aug 30, 2018
Image .flowconfig Initial commit Aug 30, 2018
Image .gitignore Initial commit Aug 30, 2018
Image .travis.yml Initial commit Aug 30, 2018
Image LICENSE Initial commit Aug 30, 2018
Image README.md Update readme with stolen text from Josh Aug 31, 2018
Image check-all.js Fix lint Mar 6, 2019
Image check-all.js.flow Export default subscribe Aug 31, 2018
Image package-lock.json 0.2.1 Mar 6, 2019
Image package.json 0.2.1 Mar 6, 2019
Image prettier.config.js Initial commit Aug 30, 2018

README.md

Check All

  • Check/uncheck [data-check-all] to check/uncheck all checkboxes in a container.
  • Shift click on [data-check-all-item] to select all checkboxes between the last checked checkbox and the target checkbox.
  • Auto-update [data-check-all-count] to count of checked items.

Installation

$ npm install @github/check-all

Usage

JS

import checkAll from '@github/check-all'
checkAll(document.querySelector('[data-check-all-container]'))

Using a library like selector-observer, the behavior can automatically be applied to any container matching a selector.

import {observe} from 'selector-observer'
import checkAll from '@github/check-all'

observe('[data-check-all-container]', { subscribe: checkAll })

HTML

<div data-check-all-container>
  Count: <span data-check-all-count>0</span>
  <label><input type="checkbox" data-check-all> Check All</label>
  <label><input type="checkbox" data-check-all-item> github/fetch</label>
  <label><input type="checkbox" data-check-all-item> github/textarea-autosize</label>
  <label><input type="checkbox" data-check-all-item> github/eventlistener-polyfill</label>
  <label><input type="checkbox" data-check-all-item> github/quote-selection</label>
</div>

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.

You can’t perform that action at this time.