npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

enhanced-checkbox-list

v1.1.0

Published

Add filtering, toggling, and select-all enhancements to existing checkbox lists

Readme

Enhanced Checkbox Lists

npm version gzip size

Accessibly enhancing checkbox lists with filtering, toggling, select-all, and keyboard shortcuts

Try out the examples

Installation / usage

Grab from NPM and use in a module system:

npm install enhanced-checkbox-list
import EnhancedCheckboxList from 'enhanced-checkbox-list';
new EnhancedCheckboxList(document.getElementById('list'), options);

Or grab the minified JavaScript from unpkg:

<script src="https://unpkg.com/enhanced-checkbox-list"></script>

I would encourage you to use your own styling to match your site or application's design. An example stylesheet is included in the dist directory however which you can copy into your project and import into the browser.

Options

{
    /**
     * generate an input to allow filtering the list
     */
    filterable: boolean = true;

    /**
     * delay after typing in the filter input before filtering (to allow for fast typers)
     */
    filterDelay: number = 300;

    /**
     * selector above checkbox to determine which element to show/hide after filtering
     */
    itemSelector: string = `li`;

    /**
     * allow toggling visibility by generate a toggle button
     */
    togglable: boolean = true;

    /**
     * if togglable, close when clicking or blurring outside of the container/button
     */
    autoClose: boolean = false;

    /**
     * if togglable, determines initial visibility
     */
    visible: boolean = false;

    /**
     * text to use for the toggle button
     */
    toggleButtonText: string | ((listLabel: string, checkedCount: number) => string) =
        (listLabel, checkedCount) => `${listLabel} (${checkedCount})`;

    /**
     * include a custom select all control;
     * this has to be a custom element due to issues with updating
     * the indeterminate state on native checkboxes in many browsers
     */
    selectAllControl: boolean = true;

    /**
     * text for select all control
     */
    selectAllText: string = `Select all`;

    /**
     * if keyboard focus is on a checkbox, allow: home, end, pageup, and pagedown shortcuts
     * to move to first, last, -10, or +10 checkbox respectively;
     * and escape key to close the wrapper if togglable
     */
    keyboardShortcuts: boolean = true;

    /**
     * the index modifier for the pageup shortcut,
     * e.g. if on the 15th checkbox, use pageup to go to the 5th
     */
    pageUpModifier: number = -10;

    /**
     * the index modifier for the pagedown shortcut,
     * e.g. if on the 5th checkbox, use pagedown to go to the 15th
     */
    pageDownModifier: number = 10;

    /**
     * selector to use when finding the checkboxes in the list
     */
    checkboxSelector: string = `input[type="checkbox"], input[type="radio"]`;

    /**
     * control the tabindex added to custom elements generated by the module
     * in case your checkbox list sits at a certain point in the page's tabbing order
     */
    tabindex: number | string = `0`;

    /**
     * string to prepend to classes for BEM naming
     * e.g. enhanced-checkbox-list__wrapper
     */
    cssNameSpace: string = `enhanced-checkbox-list`;

    /**
     * custom class name to add to the filter text input
     */
    filterClassName: string;

    /**
     * custom class name to add to the toggle button
     */
    toggleClassName: string;

    /**
     * custom class name to add to the component wrapper
     */
    wrapperClassName: string;

    /**
     * label for the checkbox list - used for the toggle button text and
     * the label for the filter input; if not provided, the module will search for one
     * using aria-label or aria-labelledby attributes, or looking for a parent fieldset's legend
     */
    listLabel: string;

    /**
     * screen reader text added to list wrapper advising shortcut to close the wrapper
     * (if toggling enabled)
     */
    srEscapeToCloseText: string = `Esc to close`;

    /**
     * screen reader text added to filter field advising shortcut to clear filter value
     * (if filtering enabled)
     */
    srEscapeToClearText: string = `Esc to clear`;

    /**
     * screen reader text used for label explaining the search/filter input;
     * combines with listLabel if available e.g. "filter departments"
     */
    srFilterText: string = `filter`;

    /**
     * partial screen reader text used in message after filtering e.g. "12 found, 3 selected"
     */
    srFoundText: string = `found`;

    /**
     * partial screen reader text used in message after filtering e.g. "12 found, 3 selected"
     */
    srSelectedText: string = `selected`;

    /**
     * callback after a filter has run
     */
    onFilter: () => void;

    /**
     * callback once ready
     */
    onReady: () => void;

    /**
     * callback when the list is toggled visible
     */
    onShow: () => void;

    /**
     * callback when the list is toggled hidden
     */
    onHide: () => void;
}