---
title: "Filters"
description: "Lets people narrow a list with filters that read like a sentence: a field, a rule, and a value. The list changes as they pick, and phones get a sheet."
url: https://gelatinui.com/components/filters
markdown_url: https://gelatinui.com/components/filters.md
access: free
install: "npx shadcn@latest add @gelatin-ui/filters"
registry_item: https://gelatinui.com/r/filters.json
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Filters

> Lets people narrow a list with filters that read like a sentence: a field, a rule, and a value. The list changes as they pick, and phones get a sheet.

Page: https://gelatinui.com/components/filters

## When to use it

Best for: Lists and reports where people combine several filters and see the rows change as they pick.

- Use it when a list has three or more fields to filter by.
- Use `value` and `onValueChange` to keep the filters in the URL or send them to a server.

## When not to use it

- For a filter bar on a Data Table, use [Data Table](https://gelatinui.com/components/data-table.md).
- For one choice from a short list, use a [Select](https://gelatinui.com/components/select.md).

## Notes for agents

- The root renders no box: put `FiltersAdd` in a toolbar row, and `FiltersBar` where the chips go.
- A field with no value is a draft: it filters nothing, and it goes when its editor closes empty.
- The match rule and the entry shape are in `lib/filter-model`.
- Under 640px a chip or the add button opens the filter sheet.

## Anatomy

```text
Filters
├─ FiltersBar (0..n)
├─ FiltersChip (0..n)
├─ FiltersAdd (0..n)
├─ FiltersClear (0..n)
├─ FilterOptionsItems (0..n)
├─ FilterOptionsChecklist (0..n)
├─ FilterOptionsTree (0..n)
└─ FilterValueEditor (0..n)
```

## API reference

### Filters

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `fields` | `readonly FilterField[]` |  | The fields people can filter by, in menu order. |
| `value` | `FilterValue` |  | The filters, in chip order (controlled). One entry per field. |
| `defaultValue` | `FilterValue` | NO_FILTERS | The first filters (uncontrolled). |
| `onValueChange` | `function` |  | Called on each change: live, as people pick and type. A draft entry filters nothing. |
| `labels` | `Partial<FiltersLabels>` |  | Words over `FILTERS_LABELS`. Keep the object stable (a module constant or a memo). |
| `locale` | `string` |  | The locale of numbers and days. Default: the page locale. |
| `disabled` | `boolean` | false |  |
| `now` | `DisplayNow` |  | The clock of the date presets and texts. Default: the time the bar mounts. |
| `previewCount` | `function` |  | The row count of a value, for "Show 42 results" in the phone sheet. |
| `children` | `ReactNode` |  | `FiltersAdd`, `FiltersBar`, and the rest of the layout. |

### FiltersBar

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `children` | `ReactNode` |  | The parts after the chips. Default: the `+` add button and Clear. |

### FiltersChip

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `field` | `string` |  | The field id of the entry. |
| `className` | `string` |  |  |

### FiltersAdd

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `"button" \| "icon"` | "button" | `button` (default): the outline "Filter" button with the F key, for a toolbar row. `icon`: the dashed `+` at the end of the chips (the default in `FiltersBar`). |
| `hotkey` | `boolean` |  | Open the field list with the F key (not in a text field). Default true for `button`. |
| `className` | `string` |  |  |

### FiltersClear

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `unstyled` | `boolean` |  | Drop the Button look and keep only `className`. Use it when `render` mounts a component with its own look (a Toggle, a ToggleGroupItem, a SelectTrigger), or the two looks mix. |
| `chevron` | `boolean` |  | Add a chevron after the content, for a button that opens a menu, a select, or a popover with its current value in front ("Heading 1", a list icon, the color "A"). See the JSDoc of `ToolbarButton`. Default `false`. |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `children` | `ReactNode` |  |  |

Also takes every prop of Base UI `Toolbar.Button`: https://base-ui.com/react/components/toolbar

### FilterOptionsItems

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `field` | `Readonly` |  |  |
| `entry` | `FilterEntry` |  | The entry, or undefined before the field has one (the add menu). |
| `onEntryChange` | `function` |  |  |

### FilterOptionsChecklist

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `field` | `Readonly` |  |  |
| `entry` | `FilterEntry` |  | The entry, or undefined before the field has one (the add menu). |
| `onEntryChange` | `function` |  |  |

### FilterOptionsTree

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `field` | `Readonly` |  |  |
| `entry` | `FilterEntry` |  | The entry, or undefined before the field has one (the add menu). |
| `onEntryChange` | `function` |  |  |

### FilterValueEditor

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `field` | `Readonly` |  |  |
| `entry` | `FilterEntry` |  | The entry, or undefined before the field has one (the add menu). |
| `onEntryChange` | `function` |  |  |
| `months` | `1 \| 2` | 2 | The calendar months side by side: 2 in a popup, 1 in the phone sheet. |
| `onDone` | `function` |  | Enter in a text or number field: the popup closes. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| FiltersBar | `filters-bar` |  |  |  |
| FiltersChip | `filters-chip` | `data-draft`, `data-invalid` |  |  |
| FiltersAdd | `filters-add` |  |  |  |
| FiltersClear | `filters-clear` |  |  |  |
| FilterOptionsItems | `filter-options-items` |  |  |  |
| FilterOptionsChecklist | `filter-options-checklist` |  |  |  |
| FilterOptionsTree | `filter-options-tree` |  |  |  |
| FilterValueEditor | `filter-value-editor` |  |  |  |

## Usage

Give the root its fields. Put the add button in a row, and the chips under it.

```tsx title="invoice-filters.tsx"
import { Filters, FiltersAdd, FiltersBar } from "@/components/data/filters";
import type { FilterField } from "@/lib/filter-model";

const fields: FilterField[] = [
  {
    id: "status",
    label: "Status",
    kind: "options",
    options: [
      { value: "paid", label: "Paid" },
      { value: "pending", label: "Pending" },
      { value: "overdue", label: "Overdue" },
    ],
  },
  { id: "amount", label: "Amount", kind: "number" },
];

export function InvoiceFilters() {
  return (
    <Filters fields={fields}>
      <FiltersAdd />
      <FiltersBar />
    </Filters>
  );
}
```

## Compose

Build it with:

- [Data Table](https://gelatinui.com/components/data-table.md): Shows the records in rows, with sort and select.
- [Badge](https://gelatinui.com/components/badge.md): Shows the status of each record.
- [Menu](https://gelatinui.com/components/menu.md): Holds the actions of one row.
- [Pagination](https://gelatinui.com/components/pagination.md): Moves between pages.
- [Empty](https://gelatinui.com/components/empty.md): Shows when no record matches, with a next action.
- [Skeleton](https://gelatinui.com/components/skeleton.md): Holds the layout while the rows load.

Rules:

- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.
- Color has a job (`color-has-a-job`): Use color only for a status, the brand action, or data; keep the rest neutral, and show a level with a small mark (a dot, a tinted badge) before a big fill.
- Real content (`real-content`): Fill the UI with content of the real product (real names, amounts, dates, and states), never lorem text or "Item 1".
- Steady text weight (`steady-weight`): Never change the font weight on hover, focus, selected, active, or open; change the color or the fill, so the text does not jump.

Patterns: `gelatin://patterns/data-list`

## Add it

```bash
npx shadcn@latest add @gelatin-ui/filters
```

It adds 132 registry items: 128 files, 27562 lines, and the npm packages `@base-ui/react`, `@internationalized/date`, `@mantine/hooks`, `@phosphor-icons/react`, `@tanstack/react-hotkeys`, `@tanstack/react-virtual`, `@xstate/react`, `clsx`, `motion`, `react-aria-components`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Button Group](https://gelatinui.com/components/button-group.md)
- [Calendar](https://gelatinui.com/components/calendar.md)
- [Cascader](https://gelatinui.com/components/cascader.md)
- [Checkbox](https://gelatinui.com/components/checkbox.md)
- [Checkbox Group](https://gelatinui.com/components/checkbox-group.md)
- [Date Field](https://gelatinui.com/components/date-field.md)
- [Date Input](https://gelatinui.com/components/date-input.md)
- [Date Presets](https://gelatinui.com/components/date-presets.md)
- [Drawer](https://gelatinui.com/components/drawer.md)
- [Histogram Slider](https://gelatinui.com/components/histogram-slider.md)
- [Input](https://gelatinui.com/components/input.md)
- [Kbd](https://gelatinui.com/components/kbd.md)
- [Label](https://gelatinui.com/components/label.md)
- [Menu](https://gelatinui.com/components/menu.md)
- [Number Field](https://gelatinui.com/components/number-field.md)
- [Popover](https://gelatinui.com/components/popover.md)
- [Range Calendar](https://gelatinui.com/components/range-calendar.md)
- [Scroller](https://gelatinui.com/components/scroller.md)
- [Search Field](https://gelatinui.com/components/search-field.md)
- [Segmented Control](https://gelatinui.com/components/segmented-control.md)
- [Slider](https://gelatinui.com/components/slider.md)
- [Spinner](https://gelatinui.com/components/spinner.md)
- [Toolbar](https://gelatinui.com/components/toolbar.md)
- [Tooltip](https://gelatinui.com/components/tooltip.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Data Table](https://gelatinui.com/components/data-table.md)
- [Data Grid](https://gelatinui.com/components/data-grid.md)
- [Button](https://gelatinui.com/components/button.md)
- [Button Group](https://gelatinui.com/components/button-group.md)

## Keyboard

| Keys | Action |
| --- | --- |
| F | Opens the field list, when `FiltersAdd` has the hotkey. |
| Enter, Space | Opens the editor of a chip part, or picks a value. |
| Arrow keys | Move between the rows of an editor. |
| Escape | Closes the editor. |

## Motion

| Part | Motion |
| --- | --- |
| Editor popup | popup · the field and value editors open on the Popup motion |
