Filter Panel
Every filter of a schema in one form, applied together: a SidePanel beside the results on wide screens, a bottom Drawer sheet on narrow ones; Apply and Reset.
Example
Applied {"archived":false}
filter-panel-demo.tsxCopy code
Installation
Copy code
npm packages
lucide-reactUsage
ImportCopy code
Use the panel when there are many filters, or people set several before looking at the results.
API reference
FilterPanel
| Prop | Type | Default |
|---|---|---|
openrequired | boolean | – |
onOpenChangerequired | (open: boolean) => void | – |
fieldsThe fields shown, in order. Default: every field but the search field. | readonly (keyof S & string)[] | – |
valueLabels | Readonly<Record<string, string>> | – |
returnFocusWhere focus goes when the side panel closes: the button that opened it. | () => HTMLElement | null | undefined | – |
labels | Partial<FilterPanelLabels> | – |
localeWrites the fields' dates and numbers; the page's `<html lang>` by default (`useLocale`). | string | – |
schema | S | – |
controller | PageController<FilterValues<S>> | – |
className | string | – |
FilterPanelTrigger
| Prop | Type | Default |
|---|---|---|
openrequired | boolean | – |
onOpenChangerequired | (open: boolean) => void | – |
countHow many filters apply, shown beside the label. | number | 0 |
ref | Ref<HTMLButtonElement> | – |
children | ReactNode | – |
className | string | – |
Other exports
countActiveFiltersfilterPanelLabelstype FilterPanelLabelstype FilterPanelPropstype FilterPanelTriggerPropsAccessibility
- Wide: a non-modal complementary region; Escape closes it and returns focus to the trigger.
- Narrow: a modal bottom sheet with a title, closed by Apply, Escape or the backdrop.
- The trigger has aria-expanded and says how many filters apply.
Agent actions
Agents set each field by its label and press Apply filters.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.