Filter bar
Quick filter chips with inline or sheet-based additional controls.
npx @swipeui/cli add filter-barWhen to use it
- Search results and lists with quick filters like Open now, Under $20 and Free delivery.
- A Filters button that expands inline choices or opens a sheet for advanced options.
- Showing which filters are active at a glance.
When not to use it
- Switching views. Use Segmented control.
- A single toggle. Use Chip.
- Complex filter forms with many fields; open a full screen.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add filter-bar- Adds
components/swipeui/ui/filter-bar.tsxand 17 shared helpers. - Installs react-native-reanimated, react-native-worklets, uniwind, clsx, tailwind-merge, expo-haptics, class-variance-authority, react-native-svg, react-native-gesture-handler, react-native-safe-area-context, @expo/ui, @gorhom/bottom-sheet, expo-blur. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { FilterBar } from '@/components/swipeui/ui/filter-bar';
<FilterBar options={filters} />;API reference
| Prop | Type | Default | Description |
|---|---|---|---|
filterPresentation? | | | Present extra filters below the chips or in a sheet. |
open? | | — | Extra filters open state, for either presentation. |
defaultOpen? | | | Initial extra-filter state. |
onOpenChange? | | — | Extra-filter open intent. |
activeCount? | | | Total active filters, including caller-owned advanced filters. |
showReset? | | | Show an inline reset while filters are active. |
onReset? | | — | Reset caller-owned advanced filters; quick filters clear through onValueChange. |
messages? | | — | Text overrides; filters overrides legacy filterLabel. |
options | | — | Available quick filters. |
value? | | — | Controlled selected identifiers. |
defaultValue? | | | Initially selected identifiers. |
onValueChange? | | — | Reports selection intent. |
filterContent? | | — | Additional filter controls rendered inline or in the free Sheet. |
filterLabel? | | | Trigger label and optional sheet heading. |
sheetEngine? | | | Sheet engine. |
disabled? | | — | Prevent opening or changing filters. |
haptics? | | — | Feedback. |
motion? | | — | Shared press/overlay character. |
className? | | — | Root classes. |
style? | | — | Root layout escape hatch. |
testID? | | — | Root identifier. |
Composition and behavior
- options are quick filter chips; value holds the active ids.
- filterContent fills the sheet; filterLabel names it.
- sheetEngine chooses the native or custom sheet.
Behavior and gestures
- Quick chips update caller-owned selected filters.
- Additional controls can open in a sheet (the compatible default) or expand inline.
- Active count and Reset reflect caller-owned quick and advanced filtering.
Accessibility
- Each filter is a toggle chip with checked state.
- The Filters button reports expanded state while additional controls are open.
- The sheet title matches the button label.
Motion
- Uses the
pressandoverlaymotion roles, so it follows your app's feel. Passmotionto tune this one instance. - The sheet uses the overlay role; chips use the press scale.
- Reduce Motion fades the sheet.
Performance
- Additional controls mount only when opened.
Notes for AI
- Put advanced controls in filterContent; apply filtering in your app.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.