Skip to content

Filter bar

hc-filterbar shows what the list is currently filtered by, and lets the user change it there: each chip opens the editor for its own condition, and the control next to it drops that condition.

It is the interactive sibling of hc-chip, which stays presentational. Keeping them apart is deliberate — a reader should be able to tell at a glance which pills are facts about a record and which are controls on a query.

Also known as: applied-filters strip, filter chips.

  • ×
  • ×
  • ×
Clear all

The editor for this one condition.

The editor for this one condition.

The editor for this one condition.

PartPurpose
.hc-filterbarRow wrapper. Collapses when there are no conditions.
.hc-filterbar__listThe scrolling <ul> — announces as “list, N items”.
.hc-filterbar__itemOne condition: its chip, and optionally its remove control.
.hc-filterbar__chipThe <button> that opens this condition’s editor.
.hc-filterbar__labelThe field name.
.hc-filterbar__opThe operator — deliberately quiet.
.hc-filterbar__valueThe value, truncated past --hc-filterbar-value-max.
.hc-filterbar__removeLink to the same URL minus this condition.
.hc-filterbar__clearLink to the unfiltered URL. Pinned to the trailing edge.

Conditions accumulate sideways. A wrapping bar pushes the data down the page and reflows it every time a condition is added or dropped, so the list moves under the reader’s eyes. Here the chips never shrink and the bar scrolls instead — and Clear all is pinned, because clearing everything must not require first scrolling to the end of the thing you want to clear.

Only the server knows a field’s label, which operator was used, and how many values a condition holds. So it renders the chip’s three parts, and a multi-value condition arrives summarised:

<span class="hc-filterbar__value">3 values</span>

Never three chips, and never a chip carrying 200 pasted codes. The full list lives in the editor the chip opens.

__remove and __clear are <a href>, not buttons: dropping a condition is a different URL, so it works without JavaScript, it is shareable, and Back puts the condition back. Add data-hx-get to swap the results in place — the href stays the no-JS path.

A condition the screen enforces (say, “owner is me”) simply renders without a remove control; the chip keeps both ends round.

  • The bar is a real list, so its size is announced.
  • Every remove control names its condition (“Remove Buyer code filter”) rather than being a bare ×.
  • Each chip is a <button popovertarget>, so the editor opens from the keyboard and Escape closes it — the browser’s own popover behavior.
  • Truncation is visual only; the editor holds the full value.
Token pathPurpose
filterbar.bg / -fg / -borderChip surface.
filterbar.hover-bgChip and remove hover.
filterbar.op-fgThe quiet parts — operator, remove, clear.
filterbar.radius / -padding-x / -padding-y / -gapShape and rhythm.
filterbar.font-sizeChip text size.
filterbar.value-maxWhere a long value truncates.
Show the generated CSS variables
--hc-filterbar-bg | -fg | -border | -hover-bg | -op-fg
--hc-filterbar-radius | -padding-x | -padding-y | -gap
--hc-filterbar-font-size | -value-max

Used in recipes: Datagrid filter