Feature Library

Filter bar: period, segments and saved views

<0.01 CPU ms
A still of the Filter bar: period, segments and saved views demo
Still
The live demo starts when it’s in view.Pick a period, a region or a channel · Views… saves, renames, deletes and picks the view that opens first · narrow the window: one button opens the filters as a sheet

The filters a dashboard or a report shares.

The filters a dashboard or a report shares: a period (presets counted back from today, or two days of your own) and segments (one value in a dropdown, several in a list of boxes), in one filter state that is kept in the page’s URL, so a link or a reload brings the same view back. Saved views can be named, renamed, deleted and one chosen to open first. On a phone the bar folds behind one button that says what is set and opens as a sheet. Days are plain calendar days, so no time zone can move them. Plain TypeScript and CSS, flat and quiet, styled by the shared tokens.

What it costs a frame

<0.01 ms
GPU
not used
CPU, median
<0.01 ms
CPU, 95th pct
<0.01 ms
Draw calls
0
Weight
Light

Measured 28 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 158, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged CPU <0.01–<0.01 ms). What ran: Measured Alone: the bar with a period, two segments, saved views and reset, inline. The bench opens the region list, ticks a box and closes it. Phones: tiers are being measured next.

How steadily it runs on RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference

Typical frame ?
16.94 ms
1% low ?
52 fps
Varies by ?
±0.56 ms
All metricsRTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference
p50p95p9916.03 ms19.80 ms +
How long each frame took. Most frames sit in the tall bars; a long tail to the right is hitching.

Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.

Frames

Median (p50) ?
16.94 ms
p95 ?
17.91 ms
p99 ?
18.36 ms
Slowest ?
20.57 ms
Mean ?
16.96 ms
Standard deviation ?
0.56 ms
1% low ?
52 fps
0.1% low ?
49 fps
Hitches ?
0 of 600
Over budget ?
0 of 600

Main thread

Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.1 / 0.3 / 0.4 ms

Input

Interactions ?
6
Input to paint ?
3.7 ms, worst 14.5
Longest handler ?
0.8 ms

Memory

JavaScript heap ?
30.5 → 31.1 MB
Growth ?
+0.55 MB

Browser

JavaScript a frame ?
0.11 ms
All tasks a frame ?
0.48 ms
Layout / style ?
0.00 / 0.02 ms
Main thread busy ?
3%

Garbage collection

Collections ?
0 (0 minor, 0 major)
Pauses ?
0.0 ms in all, longest 0.0

What it needs

Renders with
DOM and CSSPlain DOM and CSS: every current browser.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages
With an agent
install("filter-bar")Your coding agent reads its pitfalls and installs it through the library’s MCP server. Set it up

What it’s for

  1. A dashboard’s date range and filters
  2. A report’s period and cut
  3. A list or table filtered by a few fields
  4. Sharing a filtered view as a link
  5. Views people come back to every morning

Pitfalls, in brief

  1. Import filter-bar.base.css, then filter-bar.css (or your own look): the base holds the inline row, the sheet and the list of boxes; without it the sheet is a plain dialog in the middle of the screen.
  2. One bar per filter state.
  3. The URL keeps only what differs from the defaults, under prefix; it is written with history.replaceState, so filtering adds no Back steps.
  4. A hash router (#/board) is kept: the filters go in the search part before the hash.
  5. Days are YYYY-MM-DD plain days, counted from the reader’s local today (today to change it).
4 more in brief
  1. Saved views live in localStorage under storageKey, per browser.
  2. In auto the sheet follows the window’s width (sheetQuery).
  3. The sheet and the views dialog are native modal dialogs: the page behind is inert while they are open and Esc closes them.
  4. A rangeField you pass is mounted only while the period is custom and disposed when it is not: keep no reference to it.
9 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

Written for the library. Fully custom code.

filtersdate rangepresetssegmentsmulti-selectsaved viewsURL statequery stringbottom sheetdialoglocalStorageaccessibilitydomno dependencies

Near it in the frame