Frontend libraries that fit into 2 kB with dependencies.
Not tiny as a whole, but most functions are under 1 kB each (format and parse are quite heavy).
Almost moment.js-compatible API, covers most use cases,
More of the same,
Parse & format ms durations, e.g. `"1m" 60000`,
More of the same,
Format dates into stuff like X minutes ago or in X hours,
Date / time formatter, only supports padded numeric output (`September -> 09`),
Simple date / time formatter: `{h}:{mm} -> 9:33`,
Detect locale, load dictionaries, format dates / numbers, including nanostores.
Interpolation and dates / numbers, , or with react bindings.
Small core with template strings,
Bare-bones template strings (`{{hello}}, {{username}}`) and custom functions for everyting else,
Routes as a nanostores store (framework-agnostic),
Route parser and matcher in
History-based observable router,
Parse querystrings in . Not sure you need it, URL API support is good.
Convert path to regexp in
Declarative router for React / preact, , also available as a standalone hook:
The OG signals from preact core, with react integration.
Rx-style event streams,
Atomic stores with lots of framework connectors, + React extra. Supports all the top frameworks.
Signals from Solid (it almost fit into UI frameworks category itself). Author warning: it's probably buggy.
Rx-styled event streams,
4 functions to make objects observable and listen to changes,
Modular store with good tree-shaking support, vanilla, + React extra. Supports all the top frameworks.
Minimal redux-styled store with lots of framework connectors, . React extra + Vue, Svelte, Angular.
Store with useState-like API, , including React / preact connector.
Centralized store with actions, + React
A smaller signal implementation,
Simple stores with pleasant actions and selectors. Vanilla , React
Index-free, can highlight matches.
With stateful index.
One string at a time, does not compute score / rank.
Find misspellings, e.g. missipissi -> Missisipi, Commercial usage costs $42.
Matches one string at a time, tree-shakeable scores and match highlighting. total, or ~150 bytes for `hasMatch` only.
Feature-rich and customizable: multi-field indices, stop words, custom stemmers and tokenizers.
Index-free search (slower, but easier to use) with sane ordering
Quicksilver algorithm, prioritizes matches at start of word for command abbreviations (e.g. `gp` -> `git push`). One string at a time.
Similar to js-search, differs in ranking and is less strict for multi-word queries (compare). Supports field weights.
Another quicksilver-based lib, tweaked for long strings. Built-in list filtering and sorting, or 1.2 kB for single-string scoring.
Also similar, (compare)
Pan, swipe, tap, doubletap, longpress, and pinch / rotate. My personal favorite. .
Detect present and primary input method (touch / mouse) and supported events,
Unified interface for mouse, touch and pointer events,
Configurable pan, swipe, tap, doubletap, longpress. .
Tagged templates + reactive data,
React-like library with hooks and concurrency,
vDOM framework with pure JS syntax and immutable state,
React-like API (pre-hooks). Cool ecosystem of similarly tiny tools and components. Highly recommended.
Hyperapp-style templates with imperative event listeners and updates,
Hyperapp with state & effect hooks removed,
jQuery-style DOM manipulation library,
vDOM-based framework optimized for no-build setups,
The smallest validation library:
Composable functional validators, .
The most popular modular validation library with good tree-shaking,
zod-style API with fine-grained checks: `v8n().string().minLength(5).first("H").last("o")`. No tree shaking,
Another modular validation library,