Skip to content
Haze UI

Filter panel

A vertical GET form of collapsible facets with checkbox counts, a number range, a switch, in-list search and Clear all.

pnpm dlx shadcn@latest add @haze/filter-panel
Open preview in a new tab
Livesmall script

When to use

  • A product catalog, directory or table sits beside a sidebar of facets such as category, brand and price.
  • Selected filters should land in the query string so results can be linked, reloaded and server-rendered.
  • A facet has many options and needs a folded 'Show more' list with optional search.

When not to use

  • Filters sit above the results as a row of dropdowns; use filter-toolbar.
  • The filters must open from a button on small screens; put this panel inside drawer.
  • One short list of options in a form; use checkbox-group.

Installation

Add the Haze registry to components.json once, then install Filter panel with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/filter-panel
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
id*string–Prefix for the form, title and every field id.
actionstring""Where the GET form submits. Empty means the current page.
titlestring"Filters"Panel heading.
headingLevel2 | 3 | 42Heading level of the title.
facetsFacet[]–Sections. type 'options' (default): key, label, options[{ value, label, count, checked }], visibleCount, searchable, open. type 'range': min, max, step, minValue, maxValue, minName, maxName. type 'toggle': checked, description.
localestring"en-US"BCP 47 locale for the result counts.
clearHrefstring–Makes Clear all a link to the unfiltered URL. Without it Clear all is type=reset and restores the form's first state.
clearLabelstring"Clear all"Text of the clear control.
applyLabelstring"Apply"Text of the submit button.
activeLabelstring"active"Word after the active count, read as '2 active'.
resultsLabelstring"results"Spoken after each option count.
showMoreLabelstring"Show {count} more"Folded-list opener; {count} is replaced by the number of hidden options.
showFewerLabelstring"Show fewer"Folded-list closer.
searchLabelstring"Search within"Accessible name prefix of a facet search, followed by the facet label.
searchPlaceholderstring"Search"Placeholder of a facet search.
emptyLabelstring"No matches"Shown when a facet search matches nothing.
minLabelstring"Min"Label of the lower range input.
maxLabelstring"Max"Label of the upper range input.
classstring–Classes for the form, for example a fixed sidebar width.

Keyboard interactions

TabShiftTab
Move between section summaries, options, range inputs, Clear all and Apply
EnterSpace
Open or close a section or a 'Show more' list; toggle a checkbox or switch

Accessibility

  • A real form named by its heading. Every option is a native checkbox in a fieldset whose legend is the facet name; counts are announced as descriptions such as '48 results'.
  • Sections are native details elements, not exclusive, so any number can stay open; summaries show a focus ring and rotate a decorative chevron.
  • Without script the panel still filters: the form submits query parameters, 'Show more' is a nested details, and the live count and facet search simply do not appear.
  • The active count is a polite status region that is updated only when the number changes. The visible badge is hidden from assistive technology so it is not read twice.
  • On a small screen the panel is one column; place it inside drawer rather than building a second layout.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Filter panel" with `npx shadcn@latest add @haze/filter-panel`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import FilterPanel from "@/components/haze/ui/filter-panel.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/filter-panel.md

  • Customize with real content

    Adapt the Haze filter-panel ui for our product. Replace the demo values of these props with our real content: id, action, title, headingLevel, facets, locale, clearHref, clearLabel, applyLabel, activeLabel, resultsLabel, showMoreLabel, showFewerLabel, searchLabel, searchPlaceholder, emptyLabel, minLabel, maxLabel, class. Keep the layout, the heading level rules and these accessibility details: A real form named by its heading. Every option is a native checkbox in a fieldset whose legend is the facet name; counts are announced as descriptions such as '48 results'. Sections are native details elements, not exclusive, so any number can stay open; summaries show a focus ring and rotate a decorative chevron. Without script the panel still filters: the form submits query parameters, 'Show more' is a nested details, and the live count and facet search simply do not appear. The active count is a polite status region that is updated only when the number changes. The visible badge is hidden from assistive technology so it is not read twice. On a small screen the panel is one column; place it inside drawer rather than building a second layout. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using filter-panel, check it fits: use it when a product catalog, directory or table sits beside a sidebar of facets such as category, brand and price.; selected filters should land in the query string so results can be linked, reloaded and server-rendered.; a facet has many options and needs a folded 'show more' list with optional search.. Avoid it when filters sit above the results as a row of dropdowns; use filter-toolbar.; the filters must open from a button on small screens; put this panel inside drawer.; one short list of options in a form; use checkbox-group.. Alternatives: @haze/filter-toolbar, @haze/drawer, @haze/checkbox-group.

Dependencies

  • npm: @lucide/astro
  • @haze/button
  • @haze/checkbox
  • @haze/input
  • @haze/switch
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog