Skip to content
Eskais UI

Server data

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}

Installation

npx shadcn@latest add @eskais/filter-panel

Usage

Import
import { countActiveFilters, FilterPanel, filterPanelLabels, FilterPanelTrigger } from "@/components/ui/filter-panel"

Use the panel when there are many filters, or people set several before looking at the results.

API reference

FilterPanel

PropTypeDefault
openrequiredboolean–
onOpenChangerequired(open: boolean) => void–
fieldsThe fields shown, in order. Default: every field but the search field.readonly (keyof S & string)[]–
valueLabelsReadonly<Record<string, string>>–
returnFocusWhere focus goes when the side panel closes: the button that opened it.() => HTMLElement | null | undefined–
labelsPartial<FilterPanelLabels>–
localeWrites the fields' dates and numbers; the page's `<html lang>` by default (`useLocale`).string–
schemaS–
controllerPageController<FilterValues<S>>–
classNamestring–

FilterPanelTrigger

PropTypeDefault
openrequiredboolean–
onOpenChangerequired(open: boolean) => void–
countHow many filters apply, shown beside the label.number0
refRef<HTMLButtonElement>–
childrenReactNode–
classNamestring–

Other exports

countActiveFiltersfilterPanelLabelstype FilterPanelLabelstype FilterPanelPropstype FilterPanelTriggerProps

Accessibility

  • 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.