@github/task-lists-element
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

<task-lists> element

Drag and drop task list items.

Installation

$ npm install --save @github/task-lists-element

Usage

Script

Import as a module:

import '@github/task-lists-element'

With a script tag:

<script type="module" src="./node_modules/@github/task-lists-element/dist/task-lists-element.js">

Markup

<task-lists sortable>
  <ul class="contains-task-list">
    <li class="task-list-item">
      <input type="checkbox" class="task-list-item-checkbox">
      Hubot
    </li>
    <li class="task-list-item">
      <input type="checkbox" class="task-list-item-checkbox">
      Bender
    </li>
  </ul>

  <ul class="contains-task-list">
    <li class="task-list-item">
      <input type="checkbox" class="task-list-item-checkbox">
      BB-8
    </li>
    <li class="task-list-item">
      <input type="checkbox" class="task-list-item-checkbox">
      WALL-E
    </li>
  </ul>
</task-lists>

Events

const list = document.querySelector('task-lists')

list.addEventListener('task-lists-check', function(event) {
  const {position, checked} = event.detail
  console.log(position, checked)
})

list.addEventListener('task-lists-move', function(event) {
  const {src, dst} = event.detail
  console.log(src, dst)
})

Browser support

Browsers without native custom element support require a polyfill.

  • Chrome
  • Firefox
  • Safari
  • Microsoft Edge

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.

Dependencies (0)

    Dev Dependencies (15)

    Package Sidebar

    Install

    npm i @github/task-lists-element

    Weekly Downloads

    35

    Version

    2.0.5

    License

    MIT

    Unpacked Size

    20.4 kB

    Total Files

    7

    Last publish

    Collaborators

    • manuelpuyol
    • jonrohan
    • broccolini
    • primer-css
    • keithamus
    • gracepark
    • jibrangarcia
    • arelia
    • colebemis
    • smockle
    • simurai
    • khiga8
    • dustin.greif
    • srt32
    • githubbot
    • jfuchs
    • andrialexandrou
    • bteng22
    • dustin.savery