Enhanced Checkbox Lists
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
{
filterable: boolean = true;
filterDelay: number = 300;
itemSelector: string = `li`;
togglable: boolean = true;
autoClose: boolean = false;
visible: boolean = false;
toggleButtonText: string | ((listLabel: string, checkedCount: number) => string) =
(listLabel, checkedCount) => `${listLabel} (${checkedCount})`;
selectAllControl: boolean = true;
selectAllText: string = `Select all`;
keyboardShortcuts: boolean = true;
pageUpModifier: number = -10;
pageDownModifier: number = 10;
checkboxSelector: string = `input[type="checkbox"], input[type="radio"]`;
tabindex: number | string = `0`;
cssNameSpace: string = `enhanced-checkbox-list`;
filterClassName: string;
toggleClassName: string;
wrapperClassName: string;
listLabel: string;
srEscapeToCloseText: string = `Esc to close`;
srEscapeToClearText: string = `Esc to clear`;
srFilterText: string = `filter`;
srFoundText: string = `found`;
srSelectedText: string = `selected`;
onFilter: () => void;
onReady: () => void;
onShow: () => void;
onHide: () => void;
}