Filter

Filter trigger with elevated popover, field grid, and removable active chips.

Preview

Live

<div class="ui-filter is-open">
  <button type="button" class="btn btn-compact btn-with-icon ui-filter__trigger is-active"
    aria-expanded="true" aria-haspopup="dialog" aria-label="Filters, 2 active">
    <span class="ui-icon ui-icon--filter btn-icon" aria-hidden="true"></span>
    <span class="ui-filter__badge" aria-hidden="true">2</span>
  </button>
</div>
<div class="ui-filter__popover" role="dialog" aria-label="Filters">…</div>
<div class="ui-filter-chips">
  <button type="button" class="ui-filter-chip">Submitted …</button>
</div>

Variants

Active trigger

.is-active + badge when filters applied.

Full-width field

.ui-filter__field--full spans the grid.

Keyword

Removable chips

Active filter summary outside the popover.

Accessibility

  • Trigger needs an accessible name that includes active count when relevant.
  • Popover uses role="dialog" with aria-label / popoverLabel.
  • Escape closes the popover and returns focus to the trigger (React Filter).
  • Chip remove buttons should name the filter being cleared.

API

HTML classes

Class Description
.ui-filter / .is-open Root + open state.
.ui-filter__trigger / .is-active Compact filter button.
.ui-filter__badge Active count badge.
.ui-filter__popover Elevated dialog panel.
.ui-filter__fields / __field / --full Field grid.
.ui-filter__label / __footer Field label + footer actions.
.ui-filter-chips / .ui-filter-chip Active chip row + chip button.

React props

From src/core/Filter.tsxFilter, FilterField, FilterChip, FilterChips.

Prop Type Default Description
open / onOpenChange boolean / fn Controlled open state (required).
triggerLabel / popoverLabel string Accessible names (required).
activeCount number 0 Badge count; 0 hides badge.
footer / children ReactNode Footer actions + field content.
full / label boolean / ReactNode FilterField span + label.