Overview
Filter Bar is a composable toolbar that combines search input, filter dropdowns, sort controls, and action buttons. It automatically displays a result count below the bar and provides a consistent interface for filtering table data, product catalogs, and order lists.Usage
Features
Search Only
Multiple Filters
With Action Button
Multiple Actions
Filters Only (No Search)
Sort Without Label
With Table
Props
Search input config. Pass
false to hide search.placeholder?: string— Placeholder text (default: “Search…”)value?: string— Current value (controlled)onChange?: (e) => void— Change handlerwidth?: number | string— Input width
Array of filter dropdown configs:
key: string— Unique key for the filterplaceholder?: string— Placeholder textoptions: { label, value }[]— Select optionsmultiple?: boolean— Allow multiple selectionsmaxTagCount?: number— Max tags to show before “+N more” (default: 1)width?: number | string— Width (default: 160px)allowClear?: boolean— Allow clearing (default: true)value?: any— Current value (controlled)onChange?: (value) => void— Change handler
Sort dropdown config:
options: { label, value }[]— Sort optionsvalue?: string— Current value (controlled)onChange?: (value) => void— Change handlerwidth?: number | string— Width (default: 130px)showLabel?: boolean— Show “Sort by” label (default: true)
Result count displayed below the bar. Pass a number (renders “X results”) or a custom string like “24 medications”.
Extra content rendered on the right side (e.g., action buttons)
Additional class name for the container
Best Practices
Use multiple filters with
multiple: true for faceted search (categories, countries, etc.)Show result counts to give users feedback on filter effectiveness
Place action buttons in the
extra slot for quick access to “Add new”, “Export”, etc.Use controlled state for all inputs to sync with table data
Accessibility
- Wrapped in a
<search>landmark witharia-label="Filter results" - Result count has
role="status"andaria-live="polite" - All dropdowns have proper
aria-labelattributes - Sort dropdown is linked to its label via
aria-labelledby