Skip to content
HyperUX Experimental
Demo

Multi-facet filter orchestration with debounced search and range inputs, intersection-aware option states, and a unified filter state tree.

Categories

Price range

Updating…

Unavailable combinations

None for current filter state.


Alpine.js Multi-Facet / Nested Filters

huxMultiFacetFilters coordinates complex filter screens by keeping a single reactive state tree, debouncing updates, and exposing option intersection metadata for custom UI composition.

Runtime constraints

API

huxMultiFacetFilters(config)

Returns an Alpine data object with:

Internal helper methods are private implementation details and are not part of the supported API contract.

Options

FacetConfig supports:

Quick Start

<div
  x-data="huxMultiFacetFilters({
    sourceItems: products,
    facets: {
      categories: { type: 'multi', values: ['books', 'apps'], getItemValue: (item) => item.categories },
      query: { type: 'search', getItemValue: (item) => `${item.name} ${item.description}` },
      price: { type: 'range', getItemValue: (item) => item.price }
    },
    filterState: {
      categories: [],
      query: '',
      price: { min: 0, max: 100 }
    }
  })"
>
  <input
    type="search"
    x-model="filterState.query"
    x-on:input="setFilterValue('query', filterState.query)"
  />

  <button type="button" x-on:click="clearAllFilters()">Clear filters</button>

  <ul>
    <template x-for="item in filteredItems" x-bind:key="item.id">
      <li x-text="item.name"></li>
    </template>
  </ul>
</div>

Common Usage Patterns

Register facets after initialization

registerFacet('status', {
  type: 'single',
  values: ['active', 'paused', 'archived'],
})

setFilterValue('status', 'active', { debounce: false })

Disable impossible checkbox options

<template x-for="option in facetOptions('categories')" x-bind:key="option.value">
  <label>
    <input
      type="checkbox"
      x-bind:checked="option.isSelected"
      x-bind:disabled="option.isInvalid && !option.isSelected"
      x-on:change="toggleFilterValue('categories', option.value)"
    />
    <span x-text="option.value"></span>
  </label>
</template>

Listen for orchestrator change events

<div
  x-data="huxMultiFacetFilters({ filtersId: 'catalog', sourceItems: products })"
  x-on:hux-multi-facet-filters:catalog:change.window="console.log($event.detail)"
></div>

Behavior Contract

Error Handling

Accessibility Notes

Notes