Composables
useFilters
Generic filter logic composable that supports registering custom filter handler functions.
useFilters
Low-level generic filter composable that useRestaurantFilters is built on. Use it directly when you need filter behaviour for a data type other than restaurants, or when you need to register a fully custom filter handler.
Usage
const { registerHandler } = useFilters()
// Register a custom filter handler for a filter group
registerHandler('cuisine', (items, activeValues) => {
return items.filter(item => activeValues.includes(item.cuisine))
})
Returns
| Key | Type | Description |
|---|---|---|
registerHandler | (key: string, fn: FilterHandler) => void | Registers a custom filter function for the given filter group key. |
AI Context
composable: useFilters
package: "@xenterprises/nuxt-x-restaurants"
use-when: >
Building custom filterable lists outside the standard restaurant flow, or
overriding the built-in filter logic for a specific group by registering a
custom handler. useRestaurantFilters is the higher-level composable for the
standard restaurants listing page.
