# Filter bar

- **[App UI](/app/)**
- **[Data](/app/data/)**
- **Filter bar**

A search box and select filters above a list, active filters as removable chips with a clear-all, and a result count read from a list (one entry per filter removed) and…

## Notes

- **When to use it**: A search box and select filters above a list, with active filters as removable chips. For moving between pages of results use `app-data-pagination`; the table itself is `app-data-table`.
- **Writing for it**: - `title` (60) is not shown. It names the search landmark for screen readers, so write what is being searched, such as Bookings.
- Each select needs a `label` and 2 to 8 `options` of 30 characters, plus a `sample` for the value shown. Use up to 3 selects before the row gets crowded.
- `results` is a list of count phrases, one per filter removed, such as 31 bookings. The block holds no data, so you write each number yourself.
- **Watch out for**: The block filters nothing. Removing a chip only advances the count text, and removing more chips than there are `results` entries keeps the last one. Pass the host's list to the table separately.

## Pairs well with

- **[App, data table](/blocks/app/data-table)**
- **[App, pagination](/blocks/app/data-pagination)**
- **[App, search results](/blocks/app/search-results)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppDataFilters from '@/components/klarhimmel/blocks/app-data-filters';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppDataFilters props={{
          "title": "Name what is filtered",
          "searchLabel": "Name what to search",
          "sample": "",
          "selects": [
            {
              "label": "First filter",
              "options": [
                "All of the first",
                "Name option one",
                "Name option two",
                "Name option three"
              ],
              "sample": "Name option one"
            },
            {
              "label": "Second filter",
              "options": [
                "Any of the second",
                "Name option one",
                "Name option two",
                "Name option three"
              ],
              "sample": "Name option one"
            }
          ],
          "chips": [
            "First option",
            "Second option",
            "Third option"
          ],
          "removeLabel": "Remove filter",
          "clear": "Clear all",
          "results": [
            "00 results",
            "00 results",
            "00 results",
            "000 results"
          ]
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

- **title**: Text, up to 60 characters.
- **searchLabel**: Text, up to 40 characters.
- **sample**: Text, up to 60 characters.
- **selects**: List of 1 to 3. Each item: label, options, sample.
- **chips**: List of up to 5.
- **removeLabel**: Text, up to 30 characters.
- **clear**: Text, up to 30 characters.
- **results**: List of 1 to 6.

## Install

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-data-filters
  ```

Uses

- Input
- NativeSelect
- Button

- **About**: A search box and select filters above a list, active filters as removable chips with a clear-all, and a result count read from a list (one entry per filter removed) and announced politely. Focus moves on when a chip goes.
- **States**: Search, selects and removable chips. A chip leaves when removed; Clear all removes the rest; the count is a live status. New project? Set it up once: /get-started/installation.
