Filter bar
A row of native form controls that narrows a list or table.
Our choice: No standard exists: a <form> in <search> with labelled controls, and the result count as a status message.
Live example
Filter orders
<search data-filter-bar aria-label="Filter orders">
<form method="get" id="order-filters">
<div data-field>
<label for="filter-q">Search orders</label>
<input type="search" id="filter-q" name="q" placeholder="Order number">
</div>
<div data-field>
<label for="filter-status">Status</label>
<select id="filter-status" name="status">
<option value="">Any status</option>
<option>Open</option>
<option>Shipped</option>
<option>Delivered</option>
</select>
</div>
<dui-combobox>
<label for="filter-customer">Customer</label>
<input type="text" id="filter-customer" name="customer" list="filter-customers">
<datalist id="filter-customers">
<option value="Analytical Engines Ltd."></option>
<option value="Bletchley Instruments"></option>
<option value="Cobol Systems BV"></option>
<option value="Orbital Mechanics GmbH"></option>
</datalist>
</dui-combobox>
<div data-field>
<label for="filter-from">Placed on or after</label>
<input type="date" id="filter-from" name="from">
</div>
<div>
<button type="submit">Apply</button>
<button type="reset">Reset</button>
</div>
</form>
<p role="status" id="order-count">6 orders</p>
</search>
<section data-scroll="inline" aria-labelledby="orders-caption" tabindex="0">
<table id="order-table">
<caption id="orders-caption">Orders</caption>
<thead>
<tr><th scope="col">Order</th><th scope="col">Customer</th><th scope="col">Status</th><th scope="col">Placed</th><th scope="col">Total</th></tr>
</thead>
<tbody>
<tr><td>1042</td><td>Analytical Engines Ltd.</td><td>Shipped</td><td><time datetime="2025-03-12">2025-03-12</time></td><td>€1,240.00</td></tr>
<tr><td>1041</td><td>Bletchley Instruments</td><td>Delivered</td><td><time datetime="2025-03-10">2025-03-10</time></td><td>€48.50</td></tr>
<tr><td>1040</td><td>Cobol Systems BV</td><td>Open</td><td><time datetime="2025-03-09">2025-03-09</time></td><td>€3,980.00</td></tr>
<tr><td>1039</td><td>Orbital Mechanics GmbH</td><td>Open</td><td><time datetime="2025-03-07">2025-03-07</time></td><td>€615.90</td></tr>
<tr><td>1038</td><td>Analytical Engines Ltd.</td><td>Delivered</td><td><time datetime="2025-03-04">2025-03-04</time></td><td>€310.25</td></tr>
<tr><td>1037</td><td>Cobol Systems BV</td><td>Shipped</td><td><time datetime="2025-03-01">2025-03-01</time></td><td>€72.00</td></tr>
</tbody>
</table>
</section>
Compact filter bar
<div data-density="compact">
<search data-filter-bar aria-label="Filter invoices">
<form method="get">
<div data-field>
<label for="invoice-q">Search invoices</label>
<input type="search" id="invoice-q" name="q" placeholder="Invoice number">
</div>
<div data-field>
<label for="invoice-status">Status</label>
<select id="invoice-status" name="status">
<option value="">Any status</option>
<option>Draft</option>
<option>Sent</option>
<option>Overdue</option>
<option>Paid</option>
</select>
</div>
<div>
<button type="submit">Apply</button>
<button type="reset">Reset</button>
</div>
</form>
<p role="status">42 invoices</p>
</search>
</div>
Attributes
| Attribute or value | Where | Effect |
|---|---|---|
data-filter-bar | a <search> (aria-label when the page has several) |
Children: a <form> of fields (each a data-field, or a <dui-combobox>) whose last child holds the buttons, then a role="status" element with the result count.
Breakpoint
30rem of the bar's own inline size. A container query condition cannot read a custom property, so it is written as a length.
Keyboard
| Key | Action |
|---|---|
| Tab | moves through the filters, then Apply and Reset |
| Enter | in a text field, applies the filters |
Accessibility
- The status text says what changed ("24 orders match"), and is announced politely without moving focus (WCAG 4.1.3 Status Messages).
- Controls keep their size (36px, 32px compact, 44px on touch: above the 24px of WCAG 2.5.8).
Specifications
- HTML
<search>element - WCAG 4.1.3 Status Messages
- MDN
search - MDN
statusrole - WCAG Labels or instructions
See also
- Organisms
- Source:
css/components/organisms/filter-bar.css,examples/organisms/filter-bar.html - Demos: Orders view (Plain HTML, React, Angular, Astro, Vue, Svelte)
How other systems do it
For comparison only; these are not the standard this system follows.
- Apple Human Interface Guidelines: No equivalent
- Material Design 3: Chips (filter chips)
- Vercel Geist: Filter Params