Filter Menu
A filter for lists and tables: a button that opens a checklist of options with counts and a way to clear it, and a panel with search, Apply and data states for longer cases.
Playground
Installation
Filter Menu comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import {
FilterMenu,
FilterAppliedBar,
FilterMenuFooter,
FilterMenuFooterProps,
FilterMenuOption,
FilterMenuPanel,
FilterMenuPanelProps,
FilterMenuProps,
FilterMenuRow,
FilterMenuRowProps,
FilterMenuTrigger,
FilterMenuTriggerProps,
FilterPopover,
} from "@wunderui/react"Then use it:
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 for
- Data Table for filters generated from the columns, with operators, chips and server-side data
- Dropdown Menu for a menu of actions, where an entry does something and the menu closes
- Combobox for choosing a value for a form field from a searchable list
Trigger
The trigger is a plain button with the filter icon. While a filter is active it reads Status · 2 in the link colour, or shows a count pill.
Trigger
Size
Options
FilterMenu opens a menu of checkbox rows. The first row checks or clears every option and the last, Clear filter, resets, and every option checked means no filter.
Panel
FilterPopover opens a form in a popover: a title with Clear, an optional search field, checkbox or radio rows and a footer. Use it for search, groups, a single choice or an Apply step.
Data states
Options often come from a request. The panel shows loading, empty, error and no match states in place of the rows, and keeps the selection through all of them.
Applied bar
FilterAppliedBar shows what is applied as removable chips, with Clear all and an optional result count. It is the one place that says which filters are on, so put it between the controls and the list.
Keyboard interactions
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.
- EnterorSpaceorArrowDown
- 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.
- ArrowDownorArrowUp
- In the menu: moves to the next or previous row, the All row and Clear filter included.
- HomeorEnd
- In the menu: first or last row. End lands on Clear filter.
- SpaceorEnter
- 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.
- TaborShiftTab
- 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 and motion
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 turns the trigger link-coloured 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
The figure shows a FilterMenu with two of three options checked. FilterPopover, the panel, the footer and the applied bar are separate parts and have no number.
- data-slot="filter-menu"
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.
- data-slot="filter-menu-trigger"
A plain button with the filter icon and the label. While a filter is active it reads Status · 2 in the link colour, or shows a count pill, and its name says Status, 2 of 3 selected.
- data-slot="filter-menu-all"
The first row. It checks or clears every option and reads checked, mixed or empty, depending on how many options are on.
- data-slot="filter-menu-item"
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.
- data-slot="filter-menu-box"
The visual checkbox at the start of a row, filled in the tint of the row when on. It is decorative, and the row carries the checked state.
How many rows the option holds, in tabular figures on the right. Pass the count on the option.
- data-slot="filter-menu-clear"
Checks every option again and then calls your clear handler. It is disabled while no filter is active and closes the menu.
- data-slot="filter-menu-trigger"
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.
- data-slot="filter-popover"
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.
- data-slot="filter-panel"
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.
- data-slot="filter-panel-row"
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.
- data-slot="filter-panel-footer"
The status line with Reset, or in Apply mode Reset, Cancel and Apply.
- data-slot="filter-applied-bar"
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.
Best practices
- Do
Pass the real counts on the options. A count tells the person what a filter will show before they commit to it.
- Do
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.
- Do
Say what an empty result means and how to leave it: a line and Clear all, as in the example, not an empty table.
- Do
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.
- Do
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
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
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 and its related parts are plain components, so these tables list every prop. FilterPopover takes every prop of FilterMenuPanel plus the trigger props.
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.
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.
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("filter-menu")The full library index for assistants is at /llms.txt.