Skip to Content
BBRICKSv0.7.4
KitLists and tables

Filters

The filter row above a table: search grows, selects keep 140px, wraps on small screens.

import { Filters } from '@ergasti/bricks';

Examples

Filter row

The older labelled search and select, in the Filters row (ListToolbar is the standard now; see Deprecated APIs). hideLabel keeps the label for screen readers only.

Code
import { useState } from 'react';
import { Filters, SearchBox, SelectBox } from '@ergasti/bricks';

function Row() {
  const [q, setQ] = useState('');
  const [tier, setTier] = useState('');
  return (
    <Filters>
      <SearchBox id="docs-q" label="Search" value={q} onChange={setQ} />
      <SelectBox id="docs-tier" label="Tier" hideLabel value={tier} onChange={setTier} options={[['', 'All tiers'], ['rising', 'Rising'], ['elite', 'Elite']]} />
    </Filters>
  );
}

Props

Prop

Type

Design guidance

How the BRICKS design system uses Filters. Written in docs/content/components/Filters.md; the props above are read from the code, which wins where the two disagree.

The 0.1.x filter row above a list: a SearchBox that grows and SelectBoxes that keep at least 140px, wrapping on small screens; use it for simple labelled filters.

Filters is a plain flex row (10px gap, bottom-aligned) that restyles the SearchBox and SelectBox inside it: 11.5px 600 labels, --control-h controls, 13px text. The search field takes the free space (flex: 1 1 200px), each select keeps 140px. The v3 screens use ListToolbar, which adds chips, sort and a reset; Filters stays for small admin lists.

Anatomy

  1. Row (div.kit-filters): flex, wrap, align-items: flex-end.
  2. Children: SearchBox and SelectBox (each a labelled .console-list-search).

Variants

None.

States

StateTriggerLook
Wideenough widthOne row
NarrowphoneWraps; search full width

Usage

function CouponFilters({ loading, error, empty, reload }: { loading: boolean; error: string | null; empty: boolean; reload: () => void }) {
  const [q, setQ] = useState('');
  const [status, setStatus] = useState('all');
  return (
    <>
      <Filters>
        <SearchBox id="coupon-q" label="Search coupons" value={q} onChange={setQ} />
        <SelectBox id="coupon-status" label="Status" value={status} onChange={setStatus}
          options={[['all', 'All'], ['active', 'Active'], ['paused', 'Paused']]} />
      </Filters>
      <ListState loading={loading} error={error} empty={empty} emptyText="No coupons match these filters." onRetry={reload} />
    </>
  );
}

Where it appears

  • 0.1.x console lists; not in the v3 mocks (they use ListToolbar).
  • Kit gallery.

Guidelines

Do

  • Give every control a visible label.
  • Debounce the search in the list that reads it.

Don't

RTL and Arabic

  • Row follows page direction.

Tokens

--control-h, --color-control-border, --color-text-strong-neutral.

Accessibility

  • Each child has a real <label for>; Filters adds no role.

Found in the source

  • No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: BulkBar · CopyLink · CreatorCell · DataTable

Source

src/kit/Filters.tsx (line 9) on GitHub.

On this page