1.0.0 • Published 3 years ago

@kanety/stimulus-checklist v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

stimulus-checklist

A stimulus controller for checkbox list which responds to ctrl and shift click.

Dependencies

  • @hotwired/stimulus 3.0

Installation

Install from npm:

$ npm install @kanety/stimulus-checklist --save

Usage

Register controller:

import { Application } from '@hotwired/stimulus';
import ChecklistController from '@kanety/stimulus-checklist';

const application = Application.start();
application.register('checklist', ChecklistController);

Import css:

@import '@kanety/stimulus-checklist';

Build html as follows:

<ul data-controller="checklist">
  <li>
    <input type="checkbox">
    <span>text 1</span>
  </li>
  <li>
    <input type="checkbox">
    <span>text 2</span>
  </li>
</ul>

Options

filter

Filter checkboxes by css selector:

<ul data-controller="checklist"
    data-checklist-filter-value="input.first">
  <li>
    <input type="checkbox" class="first">
    <span>text 1</span>
    <input type="checkbox">
  </li>
</ul>

License

The library is available as open source under the terms of the MIT License.