~/ ← projects/ filter-dom-url

filter-dom-url

Tiny TypeScript library that keeps form filter controls in sync with URLSearchParams + history.

2025 · by dmytro · shipped · typescriptformsoss

## case study

— problem & approach #case-study

the problem

Filter UIs that change page state but live outside the URL are a UX trap: users can’t share links, can’t refresh without losing context, and back/forward buttons do the wrong thing. Most projects fix this with ad-hoc serialisation glue per page.

the approach

A zero-dependency TypeScript library (< 1.5 KB min+brotli) that turns a plain <form> into a shareable, navigable, persistable filter UI — without a state library, without a router, without a framework. Form changes write to the URL via history.pushState; URL changes (including popstate from Back / Forward) replay back into the form.

Supports select, select[multiple], and <input> types: checkbox, radio, color, range, date, month, week, time. Multi-value filters serialize as space-joined strings under a single param key. Ships ESM + CJS with bundled .d.ts declarations and sourcemaps.

stack

  • TypeScript, zero runtime dependencies
  • ESM + CJS dual build
  • Demo + docs on GitHub Pages
// (c) 2026 symonov · independent dev studio vimgittmuxdocker EOF — end of file —