# Filter Menu

A filter button that opens a checklist of options with counts, an all-row and Clear filter — for table and list filters.

- Category: Data & Tables
- Page: https://wunderui.com/components/filter-menu
- Tier: Core and Pro

## Install

Filter Menu ships with WunderUI Core and Pro in the @wunderui/react package.

## Import

```tsx
import { FilterMenu, FilterAppliedBar, FilterMenuFooter, FilterMenuFooterProps, FilterMenuOption, FilterMenuPanel, FilterMenuPanelProps, FilterMenuProps, FilterMenuRow, FilterMenuRowProps, FilterMenuTrigger, FilterMenuTriggerProps, FilterPopover } from "@wunderui/react"
```

## Minimal usage

Then use it:

```tsx
import { useState } from "react"
import { FilterMenu } from "@wunderui/react"

const options = [
  { value: "paid", label: "Paid", count: 8 },
  { value: "pending", label: "Pending", count: 4 },
  { value: "overdue", label: "Overdue", count: 2 },
]

export function StatusFilter() {
  // Every option checked means no filter.
  const [value, setValue] = useState(options.map((option) => option.value))

  return <FilterMenu label="Status" options={options} value={value} onValueChange={setValue} />
}
```

Expected result: You see a button reading Status. Press it and a menu of three checked rows opens with counts, an All row above and Clear filter below; uncheck Overdue and the button reads Status · 2.

## When to use

### Use Filter Menu for

- A multi-select filter for a list or a table, with counts and a way back to everything
- A longer or remote list that needs search, groups, a single choice or an Apply step
- The applied filters as chips between the controls and the list

### Use something else

- [Data Table](https://wunderui.com/components/data-table) for filters generated from the columns, with operators, chips and server-side data
- [Dropdown Menu](https://wunderui.com/components/dropdown-menu) for a menu of actions, where an entry does something and the menu closes
- [Combobox](https://wunderui.com/components/combobox) for choosing a value for a form field from a searchable list

## Keyboard

FilterMenu is a menu: one tab stop, then the arrow keys. FilterPopover is a form: every control is a tab stop and the arrow keys do not move between rows.

| Key | Action |
|---|---|
| `Enter` or `Space` or `ArrowDown` | On the trigger: opens the menu and moves focus into it. In a FilterPopover, Enter and Space open it and focus lands on the first row. |
| `ArrowDown` or `ArrowUp` | In the menu: moves to the next or previous row, the All row and Clear filter included. |
| `Home` or `End` | In the menu: first or last row. End lands on Clear filter. |
| `Space` or `Enter` | On a row: checks or clears it. The menu stays open, so several can be set in a row. On Clear filter: checks every option again and closes the menu. |
| `Tab` or `Shift+Tab` | In a FilterPopover: moves through Clear, the search field, the All row, each row and the footer buttons in order. There is one tab stop for every row. |
| `Esc` | Closes the menu or the popover and returns focus to the trigger. |

## Behavior

How the filter models its value, what its trigger says, and what the panel does in each mode.

- **Value:** The value is the list of checked option values. Every option checked means no filter, so the trigger is idle, and ticking a row returns the values in the order of the options.
- **All row:** In FilterMenu the All row reads checked, mixed or empty and checks or clears every option. In the panel it acts on the rows you see, so with a search active it checks only the matches.
- **Nothing checked:** Clearing every option is a filter that matches nothing. FilterMenu then reads Status · 0 and FilterPopover shows no count, while the page decides what to show, ideally a message with Clear all.
- **Trigger:** An active filter keeps the trigger in the text colour and adds the count, inline as · 2 or in a pill. Its name reads Status, 2 of 3 selected, and a trailing chevron turns while the popup is open.
- **Open and modal:** FilterMenu opens a menu that stays open while you tick, and by default locks the page behind it. FilterPopover is not modal, and both can be controlled from outside.
- **Instant and Apply:** Instant mode reports every tick. With Apply the ticks are a draft: Apply commits and closes, Cancel drops and closes, and Reset checks every option again.
- **Single choice:** In single choice mode the rows are radios and the first option stands for no filter, such as Any status. Choosing it reads as unfiltered.
- **Search and groups:** The search narrows rows by label or search text, keeps the selection and offers Clear search when nothing matches. Options in the same group sit under a group label, separated by a line.
- **Data states:** A status swaps the rows for skeletons while loading, an empty message, or an error with Retry, and keeps the selection and header. Clear is disabled in all three, and Apply too while loading.
- **Applied bar:** The bar lists what is applied as removable chips, plus Clear all. A maximum visible count hides the rest behind a +N chip, and the bar draws nothing while there are no filters.
- **Not included:** The library has no operators, field choice or saved filters. The Figma page also designs a range filter, saved filters and a property row that stay in Figma.
- **Motion:** The menu fades in and grows from the trigger, a step faster on close, and the chevron turns on the fast duration. With reduced motion the menu and chevron change without movement.

## Anatomy

- `FilterMenu`: A multi-select filter: a trigger button and a menu of checkbox rows. The value lists the checked options, and every option checked means no filter.
- `Trigger`: A plain button with the filter icon and the label. While a filter is active it reads Status · 2 in the text colour, or shows a grey count pill, and its name says Status, 2 of 3 selected.
- `All row`: The first row. It checks or clears every option and reads checked, mixed or empty, depending on how many options are on.
- `Option row`: One option as a checkbox menu item, with an optional second line and a count on the right. Ticking it keeps the menu open, and a disabled option stays in the list but cannot be changed.
- `Checkbox square`: The visual checkbox at the start of a row, filled with the brand primary like a Checkbox when on. It is decorative, and the row carries the checked state.
- `Count`: How many rows the option holds, in tabular figures on the right. Pass the count on the option.
- `Clear filter`: Checks every option again and then calls your clear handler. It is disabled while no filter is active and closes the menu.
- `FilterMenuTrigger`: The trigger button as its own part. It shows a count inline (Status · 2) or as a pill, can have a chevron that turns when open, and FilterMenu and FilterPopover render it for you.
- `FilterPopover`: The trigger plus a filter form in a popover. Use it when the filter needs a search field, groups, a single choice, Apply and Cancel or a data state.
- `FilterMenuPanel`: The filter form on its own: a title with Clear, a search field, the rows and a footer. It uses checkbox and radio semantics, so it can sit in a sidebar or a sheet as well as a popover.
- `FilterMenuRow`: One row of the panel: a checkbox or a radio, a label, an optional description and an optional count. A mixed checked state draws the select-all look.
- `FilterMenuFooter`: The status line with Reset, or in Apply mode Reset, Cancel and Apply.
- `FilterAppliedBar`: The applied filters as removable chips, an optional +N chip, Clear all and an optional result count. It draws nothing while there is no filter.
- `Count`
- `Filter Panel Clear`
- `Filter Panel Search`
- `Filter Panel All`

## Best practices

### When to use

- Use a Filter Menu for a filter on a list or table that the person sets while looking at the result. For a form that collects values, use checkboxes or a select.

### Do

- Pass the real counts on the options. A count tells the person what a filter will show before they commit to it.
- Treat every option checked as no filter, and show the applied bar only while something narrows the list. Put it between the controls and the list so filters and result read together.
- Say what an empty result means and how to leave it: a line and Clear all, as in the example, not an empty table.
- Use FilterPopover when the list is long, comes from a request or needs Apply, and give it a status so loading, empty and error each have a state instead of a blank panel.
- Name the filter by what it filters, such as Status or Owner, not Filters, once a page has more than one.

### Don't

- Don't turn off the modal behaviour on a real page unless you want the page behind the menu to stay usable. By default it locks the page, as every menu does.
- Don't expect operators or a choice of fields. A filter menu is one field with a list of values; for is, contains and between per column, use Data Table.
- Don't use Apply for a short list that filters instantly. Use it when each change is expensive, such as a request, and say what is applied next to the button.

## API reference

### FilterMenu

| Prop | Type | Default | Description |
|---|---|---|---|
| onValueChange* | (value: string[]) => void |  | Called with the next checked values, in the order of `options`. |
| options* | FilterMenuOption[] |  | The options: `value`, `label`, and optionally `count`, `description` and `disabled`. `group` and `searchText` are read by the panel and ignored by FilterMenu. |
| value* | string[] |  | The checked option values. Every option checked means no filter. In single mode it holds the one chosen value. |
| align | "start" \| "center" \| "end" | "end" | How the menu lines up with the trigger: `start`, `center` or `end`. Default `end`. |
| allLabel | string | "All" | The text of the row that checks or clears every option. Default `All`. |
| chevron | boolean |  | Shows a trailing chevron that turns when the popup is open. |
| className | string |  | Extra classes for the trigger. |
| countStyle | "inline" \| "pill" |  | `inline` writes the count as `· 2` after the label, `pill` draws it in a small pill. Default `inline`. |
| defaultOpen | boolean |  | Starts the popup open when it is not controlled. |
| icon | React.ReactNode |  | The icon before the label. Default the lucide list-filter glyph. |
| label | string | "Filters" | The text of the trigger. Default `Filters`. |
| modal | boolean |  | Whether the page behind the menu is locked while it is open. Default `true`; `false` leaves the page usable. |
| onClear | () => void |  | Called after Clear filter has checked every option again, for example to go back to the first page. |
| onOpenChange | (open: boolean) => void |  | Called when the popup opens or closes. |
| open | boolean |  | Whether the popup is open. Pass it with `onOpenChange` to control it; without it the popup keeps its own state. |
| size | "sm" \| "md" \| "lg" | "md" | `sm`, `md` or `lg`, following the button scale. Default `md`. |

### FilterAppliedBar

| Prop | Type | Default | Description |
|---|---|---|---|
| filters* | AppliedFilter[] |  | The applied filters: `{ id, label, value }` each. A chip reads `label: value`. |
| className | string |  | Extra classes for the bar. |
| clearAllLabel | string | "Clear all" | The text of Clear all. Default `Clear all`. |
| maxVisible | number |  | Shows this many chips and a +N chip for the rest; pressing +N shows them all. |
| onClearAll | () => void |  | Called by Clear all. Without it the button is left out. |
| onRemove | (id: string) => void |  | Called with the `id` of the filter whose chip was removed. |
| resultCount | number |  | Shows the number of results at the right, as a polite status. |
| resultLabel | (count: number) => string |  | Builds the text of the result count: `(count) => "3 results"`. |

### FilterMenuFooter

| Prop | Type | Default | Description |
|---|---|---|---|
| apply | boolean | false | Draws Reset, Cancel and Apply instead of Reset alone. |
| applyDisabled | boolean | false | Disables Apply, for example while the options load. |
| applyLabel | string | "Apply" | The text of Apply. Default `Apply`. |
| cancelLabel | string | "Cancel" | The text of Cancel. Default `Cancel`. |
| className | string |  | Extra classes for the footer. |
| onApply | () => void |  | Called when Apply is pressed. |
| onCancel | () => void |  | Called when Cancel is pressed. |
| onReset | () => void |  | Called when Reset is pressed. |
| resetLabel | string | "Reset" | The text of Reset. Default `Reset`. |
| text | string | "" | The status text, such as `14 results`. |

### FilterMenuPanel

| Prop | Type | Default | Description |
|---|---|---|---|
| onValueChange* | (value: string[]) => void |  | Called with the next checked values, in the order of `options`. |
| options* | FilterMenuOption[] |  | The options: `value`, `label`, and optionally `count`, `description` and `disabled`. `group` and `searchText` are read by the panel and ignored by FilterMenu. |
| value* | string[] |  | The checked option values. Every option checked means no filter. In single mode it holds the one chosen value. |
| allLabel | string | "All" | The text of the row that checks or clears every option. Default `All`. |
| allRow | boolean | true | Shows the All row in multiple mode. Default `true`. |
| apply | boolean | false | Holds the ticks as a draft until Apply is pressed. The footer then has Reset, Cancel and Apply. |
| applyLabel | string | "Apply" | The text of the Apply button. Default `Apply`. |
| cancelLabel | string | "Cancel" | The text of the Cancel button. Default `Cancel`. |
| className | string |  | Extra classes for the root element. |
| clearLabel | string | "Clear" | The text of the header Clear button. Default `Clear`. |
| emptyAction | React.ReactNode |  | A button or link for the empty state. |
| emptyDescription | string |  | The line under the empty title. |
| emptyTitle | string | "No options available" | The title of the empty state. Default `No options available`. |
| errorDescription | string | "Check your connection and try again." | The line under the error title. Default `Check your connection and try again.` |
| errorTitle | string | "Couldn’t load options" | The title of the error state. Default `Couldn't load options`. |
| noMatchDescription | string | "Try another term. Your selection is kept." | The line under it. Default `Try another term. Your selection is kept.` |
| noMatchTitle | string |  | The title shown while a search finds nothing. Default `No matches for “…”`. |
| onApply | (value: string[]) => void |  | Called with the applied values when Apply is pressed. In a popover it also closes. |
| onCancel | () => void |  | Called when Cancel is pressed. The draft is dropped; in a popover it also closes. |
| onClear | () => void |  | Called by Clear after the selection is reset to the unfiltered state. |
| onReset | () => void |  | Called by Reset after the selection is reset. |
| onRetry | () => void |  | Called by Retry in the error state. Without it the error has no button. |
| onSearchChange | (query: string) => void |  | Called with the next search text. |
| resetLabel | string | "Reset" | The text of the footer Reset button. Default `Reset`. |
| resultCount | number |  | Shows a footer with `n results`. In Apply mode the footer is always there. |
| resultLabel | (count: number) => string |  | Builds the text of the result count: `(count) => "3 results"`. |
| search | string |  | The search text. Pass it with `onSearchChange` to control it. |
| searchable | boolean | false | Shows a search field that narrows the rows by label or `searchText`. The selection is kept while you search. |
| searchPlaceholder | string | "Search…" | The placeholder and accessible name of the search field. Default `Search…`. |
| selection | "multiple" \| "single" | "multiple" | `multiple` shows checkboxes and an All row; `single` shows radios and treats the first option as the unfiltered choice. Default `multiple`. |
| status | "ready" \| "loading" \| "empty" \| "error" | "ready" | `ready`, `loading`, `empty` or `error`. Loading draws skeleton rows, empty and error draw a message in place of the rows. Default `ready`. |
| statusText | string |  | A fixed footer text that replaces the result count. |
| surface | boolean | true | Draws the panel as a popover surface with a border and a shadow. FilterPopover turns it off because the popover supplies it. Default `true`. |
| title | string |  | The heading of the panel. It names the group and, in a popover, is the default label of the trigger. The header with its Clear button shows only when you set it. |

### FilterMenuRow

| Prop | Type | Default | Description |
|---|---|---|---|
| label* | React.ReactNode |  | The text of the row. |
| checked | boolean \| "mixed" | false | `true`, `false` or `"mixed"` for the select-all state. |
| count | number \| string |  | A number or a text on the right. Numbers are formatted with thousands separators. |
| description | string |  | A second line under the label. |
| emphasis | boolean | false | Sets the label in medium weight, as the All row does. |
| kind | "checkbox" \| "radio" | "checkbox" | `checkbox` or `radio`. Default `checkbox`. |

Also accepts React.ButtonHTMLAttributes attributes.

### FilterMenuTrigger

| Prop | Type | Default | Description |
|---|---|---|---|
| active | boolean | false | Marks the filter as active: it adds the count. |
| chevron | boolean | false | Shows a trailing chevron that turns when the popup is open. |
| className | string \| ((state: State) => string \| undefined) |  | Extra classes for the button. |
| count | number |  | The number of selected options. It shows only while `active`. |
| countStyle | "inline" \| "pill" | "inline" | `inline` writes the count as `· 2` after the label, `pill` draws it in a small pill. Default `inline`. |
| focusableWhenDisabled | boolean | false | Keeps a disabled trigger in the tab order. It is a prop of the Button the trigger is built on. |
| icon | React.ReactNode |  | The icon before the label. Default the lucide list-filter glyph. |
| label | string | "Filters" | The text of the trigger. Default `Filters`. |
| nativeButton | boolean | true | Whether the element is a native button. A prop of the Button the trigger is built on. |
| open | boolean | false | Draws the open look: the pressed background and a turned chevron. |
| pending | boolean |  | Shows a spinner and ignores presses. A prop of the Button the trigger is built on. |
| phase | "error" \| "success" \| "pending" \| "idle" |  | `idle`, `pending`, `success` or `error`. A prop of the Button the trigger is built on. |
| render | React.ReactElement \| ComponentRenderFn<RenderFunctionProps, State> |  | Replaces the rendered element. A prop of the Button the trigger is built on. |
| shape | "rounded" \| "pill" |  | `rounded` or `pill`. A prop of the Button the trigger is built on. |
| size | "sm" \| "md" \| "lg" | "md" | `sm`, `md` or `lg`, following the button scale. Default `md`. |
| style | React.CSSProperties \| ((state: State) => React.CSSProperties \| undefined) |  | Inline style for the button. |

Also accepts React.ButtonHTMLAttributes attributes.

### FilterPopover

| Prop | Type | Default | Description |
|---|---|---|---|
| onValueChange* | (value: string[]) => void |  | Called with the next checked values, in the order of `options`. |
| options* | FilterMenuOption[] |  | The options: `value`, `label`, and optionally `count`, `description` and `disabled`. `group` and `searchText` are read by the panel and ignored by FilterMenu. |
| value* | string[] |  | The checked option values. Every option checked means no filter. In single mode it holds the one chosen value. |
| align | "start" \| "center" \| "end" | "start" | How the popover lines up with the trigger: `start`, `center` or `end`. Default `start`. |
| allLabel | string |  | The text of the row that checks or clears every option. Default `All`. |
| allRow | boolean |  | Shows the All row in multiple mode. Default `true`. |
| apply | boolean |  | Holds the ticks as a draft until Apply is pressed. The footer then has Reset, Cancel and Apply. |
| applyLabel | string |  | The text of the Apply button. Default `Apply`. |
| cancelLabel | string |  | The text of the Cancel button. Default `Cancel`. |
| chevron | boolean | true | Shows a trailing chevron that turns when the popover is open. Default `true`. |
| className | string |  | Extra classes for the form inside the popover. |
| clearLabel | string |  | The text of the header Clear button. Default `Clear`. |
| contentClassName | string |  | Extra classes for the popover. |
| countStyle | "inline" \| "pill" | "pill" | `inline` or `pill`. Default `pill`. |
| defaultOpen | boolean |  | Starts the popup open when it is not controlled. |
| emptyAction | React.ReactNode |  | A button or link for the empty state. |
| emptyDescription | string |  | The line under the empty title. |
| emptyTitle | string |  | The title of the empty state. Default `No options available`. |
| errorDescription | string |  | The line under the error title. Default `Check your connection and try again.` |
| errorTitle | string |  | The title of the error state. Default `Couldn't load options`. |
| icon | React.ReactNode |  | The icon before the label. Default the lucide list-filter glyph. |
| label | string |  | The text of the trigger. Default the `title`, else `Filters`. |
| noMatchDescription | string |  | The line under it. Default `Try another term. Your selection is kept.` |
| noMatchTitle | string |  | The title shown while a search finds nothing. Default `No matches for “…”`. |
| onApply | (value: string[]) => void |  | Called with the applied values when Apply is pressed. In a popover it also closes. |
| onCancel | () => void |  | Called when Cancel is pressed. The draft is dropped; in a popover it also closes. |
| onClear | () => void |  | Called by Clear after the selection is reset to the unfiltered state. |
| onOpenChange | (open: boolean) => void |  | Called when the popup opens or closes. |
| onReset | () => void |  | Called by Reset after the selection is reset. |
| onRetry | () => void |  | Called by Retry in the error state. Without it the error has no button. |
| onSearchChange | (query: string) => void |  | Called with the next search text. |
| open | boolean |  | Whether the popup is open. Pass it with `onOpenChange` to control it; without it the popup keeps its own state. |
| resetLabel | string |  | The text of the footer Reset button. Default `Reset`. |
| resultCount | number |  | Shows a footer with `n results`. In Apply mode the footer is always there. |
| resultLabel | (count: number) => string |  | Builds the text of the result count: `(count) => "3 results"`. |
| search | string |  | The search text. Pass it with `onSearchChange` to control it. |
| searchable | boolean |  | Shows a search field that narrows the rows by label or `searchText`. The selection is kept while you search. |
| searchPlaceholder | string |  | The placeholder and accessible name of the search field. Default `Search…`. |
| selection | "multiple" \| "single" | "multiple" | `multiple` shows checkboxes and an All row; `single` shows radios and treats the first option as the unfiltered choice. Default `multiple`. |
| size | "sm" \| "md" \| "lg" | "md" | `sm`, `md` or `lg`, following the button scale. Default `md`. |
| status | "ready" \| "loading" \| "empty" \| "error" |  | `ready`, `loading`, `empty` or `error`. Loading draws skeleton rows, empty and error draw a message in place of the rows. Default `ready`. |
| statusText | string |  | A fixed footer text that replaces the result count. |
| title | string |  | The heading of the panel. It names the group and, in a popover, is the default label of the trigger. The header with its Clear button shows only when you set it. |
| triggerClassName | string |  | Extra classes for the trigger. |

## Examples

### Trigger: state and count style

### Size: small, medium and large

### Options: counts, descriptions, a disabled option and a long list

### Panel: instant, Apply and Cancel, single choice, search and groups

### Data states: ready, loading, empty, error and no match

### Applied bar: chips, overflow and the result count

## In context

### Invoices: two filters, the applied bar and a table

Status is a Filter Menu, Owner a Filter Popover with search. The bar appears only once a filter narrows the rows, and if nothing matches the table says so and offers Clear all.

### Apply: the page changes when the person says so

In Apply mode the ticks are a draft. The line below the button keeps showing what is applied until Apply is pressed, Cancel throws the draft away, and Reset checks every option again.

### Options that load: loading, an outage and Retry

The owners are fetched when the popover opens. Turn on Simulate an outage and open it again to see the panel say it could not load them, with a Retry.

## For AI agents

`get_component("filter-menu")`

Hand your agent this page as Markdown or the WunderUI MCP server, not a screenshot.
