gitmyhub

list.js

JavaScript ★ 11k updated 1y ago

The perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on existing HTML.

A tiny, dependency-free JavaScript library that adds live search, sort, filter, and pagination to any existing HTML list or table, no framework required.

JavaScriptsetup: easycomplexity 2/5

List.js is a small JavaScript library that adds search, sort, and filter capabilities to HTML lists, tables, and other elements already on a page. You drop it into an existing web page without rewriting your HTML, and it quietly wires up the interactive features behind the scenes.

The main use case is any web page where you have a collection of items and you want users to be able to type in a search box to narrow them down, click a column header to sort, or apply filters by category or value. The library handles all of that logic without requiring a separate framework or build process.

Setup is straightforward. You include the script via a package manager like npm or via a CDN link, point it at the HTML element holding your items, and tell it which fields to index. From there the library manages the display, hiding and showing rows or list items as the user interacts.

The README lists several working demos: searching an existing list, adding and removing items dynamically, fuzzy search (which finds approximate matches rather than exact ones), and pagination for long lists. The library works with standard browsers including older versions of Internet Explorer.

It has no dependencies on other libraries, which keeps the file size small and avoids version conflicts. The project is MIT-licensed and has been maintained since 2011, with documentation hosted separately at listjs.com covering options, the list API, and the item API.

Where it fits