Krizaka UI
Krizaka UI
ComponentsForms

Filter bar

The bar above a list: its saved views, the controls that narrow it, the filters in force as removable chips, “Clear filters”, and the count of results — the state kept by the app, in the address.

Web · ✓Mobile · ✗ to buildDesktop · ✓BetaForms
Domain
Forms
Support level
Beta
Size
9.3 kB gzip, budget 35.5 kB
Who uses it
7 files of the live products and sites import it (Verikora: 5, Folioviv: 2) Counted in the dated inventory of 2026-11-23.
import { FilterBar, FilterMenu, SavedViews, readFilterParams, writeFilterParams } from "@krizaka/ui/filter-bar";

Web only — React, from @krizaka/ui/filter-bar. Beta: its API may still change in a minor version.

  • Mobile · ✗ to build. No phone list screen filters yet; when one does, chips and a sheet. issue #277

Why it is here. Used by Verikora, Folioviv.

When to use

  • Above a table or a grid people narrow with several criteria at once: status, type, owner, period, a query.
  • When a list has views to come back to (system the admin's, workspace shared, mine): views shows them with their counts, and one menu on a phone.
  • When the filters must be visible and undoable one by one, and shared in a link.

When not to use

  • For one choice among a few views of a list: chips in a single group.Use instead: Chip
  • For a search alone: a search field.Use instead: Search field

Installation

Install

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { FilterBar, FilterMenu, SavedViews, readFilterParams, writeFilterParams } from "@krizaka/ui/filter-bar";

Examples

Jobs

A search, a status menu (several values), a model menu (one value), the chips and the count.

A filter's menu

FilterMenu open: checkboxes with the count each value would give.

Saved views

views: the standard, shared and own views as chips with counts (one menu on a phone), a « modified » mark, « Save view », rename and delete.

In the address

The filters read from and written to URLSearchParams, the page reset on change.

Props

FilterBar

The bar of filters above a list: controls, active filters as chips, clear all, the count of results.

PropTypeDefaultDescription
labelrequiredstring—The accessible name of the bar ("Filter jobs"), passed translated.
activereadonly ActiveFilter[][]The filters in force, each a removable chip.
childrenReactNode—The controls: SearchField, FilterMenu, DateRangePicker, a Chip.Group…
clearLabelstringClear filtersThe "Clear all" button ("Clear filters"), passed translated.
onClearAll(() => void)—Clears every filter; the "Clear all" button shows when there is at least one.
removeLabel((label: string) => string)(text) => `Remove ${text}`A chip's remove button: (label) => "Remove " + label, passed translated.
resultsstring—The count of results ("42 jobs"), announced politely when it changes.
viewsSavedViewsProps—The saved views of the list, above the controls: chips with counts, a menu on a phone (SavedViews).

FilterMenu

A filter's button and its menu of options — checkboxes (several values) or radios (one) — with a count of chosen ones.

PropTypeDefaultDescription
labelrequiredstring—The name of the filter on its button ("Status"), passed translated.
onValueChangerequired((value: string[]) => void) | ((value: string) => void)—Called with the values chosen. Called with the value chosen.
optionsrequiredreadonly FilterOption[]—The choices.
valuerequiredstring | readonly string[]—The values chosen. The value chosen, "" for none.
classNamestring—Classes merged on the button.
defaultOpenboolean—Opens the menu at first (a story, a test).
multipleboolean—Several values (checkboxes, default) or one (radios). One value: the options are radios.

SavedViews

The views of a list: chips with counts on a wide screen, one menu on a phone; save, rename and delete; the mark of a modified view.

PropTypeDefaultDescription
currentrequiredstring | null—The id of the view in force, or null.
viewsrequiredreadonly SavedViewItem[]—The views, in the order to show them inside each group.
classNamestring—Classes merged on the root.
labelsPartial<SavedViewsLabels>—The words, passed translated (English by default).
linkAsLinkComponent—Your router's link for the views that have an href.
maxLengthnumber80The most characters of a name (default 80, the contract's NAME_MAX).
modifiedboolean—The filters in force differ from the view's (!sameFilters(...)), or none matches a view: shows the mark and « Save view ».
onDelete((id: string) => void)—A view was deleted (the host confirms, or offers an undo). Without it the action is not offered.
onRename((id: string, name: string) => void)—A view was renamed. Without it the action is not offered.
onSave((name: string) => void)—« Save view » was confirmed with this name. Without it the button is not shown.
onSelect((id: string) => void)—A view was chosen (a button). Not called for a view that has an href: the link navigates.

Accessibility

  • The bar is a group named by label; each chip's remove button is named by removeLabel (“Remove Status: Failed”).
  • The count of results is a polite live region: a change of filter is heard without moving the focus.
  • Saved views: each group (standard, shared, mine) is a named group of chips with one selected (a radio group, arrows); with href they are links, the current one aria-current. On a phone the same views are one menu (« View: To decide »). Naming a view opens a field that takes the focus; Enter keeps it, Esc leaves.
  • FilterMenu is a Radix menu of checkbox (or radio) items: their state is announced as they toggle.

Keyboard

KeysAction
Enter / Space / Arrow DownOpens a filter's menu.
Arrow keysMove between the options of an open menu; Space checks one, the menu stays open.
EscCloses the menu and returns to its button.

Best practices

  • Keep the filters in the address: readFilterParams on load, writeFilterParams (which resets the page) on change. For views, parseView / viewSearch / sameFilters of @krizaka/organize/contract move the filters and tell when a view is « modified »; give each view an href and it is a link.
  • Give each active chip the filter's name and value (“Status: Failed”), not the value alone.
  • Count the results in results (“42 jobs”): it is announced when it changes.
  • Use FilterMenu for a list of values (checkboxes, or radios with multiple={false}), a DateRangePicker for a period.

Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page