Command Palette
The ⌘K switcher done properly: focus stays in the input while aria-activedescendant moves, arrows wrap, and the highlight resets on every query change.
The strip above a result set that answers "why am I only seeing four things" — every active constraint as a removable chip, with the excluded count beside it.
components/applied-filters-bar.tsxnpx hoverlab add applied-filters-bar
Or over MCP, from your editor's agent — no account needed.
Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.
Start a page with this section — add more, order them, and leave with the page source.
12 of 840 projects
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
'use client'
/**
* <AppliedFiltersBar> — what is currently being filtered, and how to undo it.
*
* Command & Search had the palette, the grouped results and the shortcuts
* sheet. <FilterDrawerFacets> has the checkboxes. What nothing here had is
* the strip that sits above a result set and answers the question people
* actually ask, which is not "what can I filter by" but "why am I only
* seeing four things".
*
* THE BUG THIS BLOCK EXISTS TO PREVENT
*
* A filter set inside a drawer, on a previous page, or from a URL someone
* pasted is invisible once the drawer closes. The user sees an empty or
* absurdly short result list and concludes the product has no data. They do
* not think "I must have a filter on", because from where they are sitting
* there is no evidence of one. Support tickets from this are indistinguishable
* from real outages.
*
* So every active constraint is a chip, always visible, each removable on its
* own, with one clear-all. Nothing else in the interface is allowed to be the
* only place a filter is visible.
*
* THE COUNT IS PART OF THE ANSWER
*
* "12 of 840" says both what survived and how much was excluded. A bare "12
* results" hides the size of the cut, which is exactly the number that tells
* someone whether to loosen a filter or accept the answer.
*
* SORT IS NOT A FILTER AND IS NOT A CHIP
*
* A chip means "removing this shows you more". Sort changes order, never
* membership, so putting it in the same row teaches people that removing a
* chip might reorder their results. It sits on the other side of the bar.
*
* ACCESSIBILITY
*
* The strip is a labelled `<ul>` — "active filters, 3 items" tells someone
* using a screen reader the state of the page in one announcement, which is
* the same thing the chips do visually. Each remove button names its own
* filter ("Remove filter: Status is Active") rather than saying "remove",
* because a list of nine identical "remove" buttons is not navigable. The
* count is a live region so it is heard as chips come off.
*/
import * as React from 'react'
import { SlidersHorizontal, X } from 'lucide-react'
export interface ActiveFilter {
id: string
/** The facet: "Status", "Owner", "Updated". */
field: string
/** The chosen value, already formatted for reading. */
value: string
/**
* Whether this one can be taken off.
*
* Some constraints are structural — a workspace scope, a permission
* boundary — and rendering those as removable chips promises something
* the product cannot deliver. Shown, greyed, without an X.
*/
locked?: boolean
}
export interface AppliedFiltersBarProps {
filters?: ActiveFilter[]
matched?: number
total?: number
sortOptions?: { value: string; label: string }[]
onOpenFilters?: () => void
onChange?: (remaining: ActiveFilter[]) => void
className?: string
}
const DEFAULT_FILTERS: ActiveFilter[] = [
{ id: 'workspace', field: 'Workspace', value: 'Northwind', locked: true },
{ id: 'status', field: 'Status', value: 'Active' },
{ id: 'owner', field: 'Owner', value: 'Priya Raman' },
{ id: 'updated', field: 'Updated', value: 'Last 30 days' },
{ id: 'tag', field: 'Tag', value: 'billing' },
]
const DEFAULT_SORTS = [
{ value: 'recent', label: 'Recently updated' },
{ value: 'name', label: 'Name A–Z' },
{ value: 'created', label: 'Newest first' },
]
export function AppliedFiltersBar({
filters = DEFAULT_FILTERS,
matched = 12,
total = 840,
sortOptions = DEFAULT_SORTS,
onOpenFilters,
onChange,
className = '',
}: AppliedFiltersBarProps) {
// Per-instance ids. A literal id in a reusable component is a
// collision waiting for the second copy on the page — and a <label>
// then resolves to whichever input rendered first.
const uid = React.useId()
const [active, setActive] = React.useState(filters)
const [sort, setSort] = React.useState(sortOptions[0]?.value ?? '')
const removable = active.filter((f) => !f.locked)
function remove(id: string) {
const next = active.filter((f) => f.id !== id)
setActive(next)
onChange?.(next)
}
function clearAll() {
const next = active.filter((f) => f.locked)
setActive(next)
onChange?.(next)
}
/*
A stand-in count that grows as filters come off, so the demo responds
instead of sitting still while the chips change.
Deliberately a guess and deliberately derived rather than stored: in a
real implementation this is the number the query returned, and nothing
else in the component depends on it.
*/
const removed = filters.filter((f) => !f.locked).length - removable.length
const shown = Math.min(total, Math.round(matched * Math.pow(2.4, removed)))
return (
<section
aria-labelledby={`${uid}-filters-bar-heading`}
className={`mx-auto w-full max-w-4xl px-4 py-16 sm:px-6 lg:px-8 ${className}`}
>
<h2 id={`${uid}-filters-bar-heading`} className="sr-only">
Active filters and sorting
</h2>
<div className="rounded-2xl border border-border bg-card">
<div className="flex flex-wrap items-center gap-3 border-b border-border px-4 py-3">
<button
type="button"
onClick={onOpenFilters}
className="inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
>
<SlidersHorizontal aria-hidden className="h-4 w-4" />
Filters
{removable.length > 0 ? (
<span className="ms-0.5 rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground">
{removable.length}
</span>
) : null}
</button>
{/* Live: the number is the answer to "why so few", and it changes
under the reader's hands. */}
<p role="status" className="text-sm text-muted-foreground">
<span className="font-medium text-foreground">
{shown.toLocaleString('en-US')}
</span>{' '}
of {total.toLocaleString('en-US')} projects
</p>
{/* Sort lives on the other side of the bar. It is not a chip
because removing it would not show you more. */}
<label className="ms-auto flex items-center gap-2 text-sm text-muted-foreground">
<span className="sr-only">Sort results by</span>
<select
value={sort}
onChange={(event) => setSort(event.target.value)}
className="h-8 rounded-lg border border-field bg-background px-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
>
{sortOptions.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
</label>
</div>
{active.length > 0 ? (
<div className="flex flex-wrap items-center gap-2 px-4 py-3">
<ul
aria-label={`Active filters, ${active.length}`}
className="flex flex-wrap items-center gap-2"
>
{active.map((filter) => (
<li key={filter.id}>
<span
className={`inline-flex items-center gap-1.5 rounded-lg py-1 ps-2.5 text-sm ${
filter.locked
? 'pe-2.5 bg-muted/60 text-muted-foreground'
: 'pe-1 bg-muted text-foreground'
}`}
>
<span className="text-muted-foreground">{filter.field}:</span>
<span className="font-medium">{filter.value}</span>
{filter.locked ? null : (
<button
type="button"
onClick={() => remove(filter.id)}
className="rounded p-0.5 text-muted-foreground transition hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
<X aria-hidden className="h-3.5 w-3.5" />
{/* Named, because nine "remove" buttons are not
navigable. */}
<span className="sr-only">
Remove filter: {filter.field} is {filter.value}
</span>
</button>
)}
</span>
</li>
))}
</ul>
{removable.length > 0 ? (
<button
type="button"
onClick={clearAll}
className="ms-1 rounded text-sm font-medium text-muted-foreground underline-offset-4 transition hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
>
Clear all
</button>
) : null}
</div>
) : (
<p className="px-4 py-3 text-sm text-muted-foreground">
No filters applied — you are seeing everything.
</p>
)}
</div>
</section>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/applied-filters-bar.tsx and import it where you need the section:
import { AppliedFiltersBar } from '@/components/applied-filters-bar'2 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.
Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.
| Prop | Type | Default |
|---|---|---|
filters | ActiveFilter[] | DEFAULT_FILTERS |
matched | number | 12 |
total | number | 840 |
sortOptions | { value: string; label: string }[] | DEFAULT_SORTS |
onOpenFilters | () => void | — |
onChange | (remaining: ActiveFilter[]) => void | — |
className | string | '' |
The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.
This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.
<!--
Applied Filters Bar — markup from the Hoverlab catalog.
This is the block rendered once to HTML and wrapped as a component
file. It is not a port of the React source: the Tailwind classes carry
the design, which is the part that took the work, and they are the same
in every framework.
This block is interactive in React and the handlers are NOT here.
Buttons, toggles and menus render in their initial state and do
nothing until you wire them up.
-->
<section aria-labelledby="_R_0_-filters-bar-heading" class="mx-auto w-full max-w-4xl px-4 py-16 sm:px-6 lg:px-8 ">
<h2 id="_R_0_-filters-bar-heading" class="sr-only">Active filters and sorting</h2>
<div class="rounded-2xl border border-border bg-card">
<div class="flex flex-wrap items-center gap-3 border-b border-border px-4 py-3">
<button type="button" class="inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sliders-horizontal h-4 w-4" aria-hidden="true"><line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line></svg>Filters<span class="ms-0.5 rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground">4</span></button>
<p role="status" class="text-sm text-muted-foreground"><span class="font-medium text-foreground">12</span> of 840 projects</p>
<label class="ms-auto flex items-center gap-2 text-sm text-muted-foreground">
<span class="sr-only">Sort results by</span>
<select class="h-8 rounded-lg border border-field bg-background px-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background">
<option value="recent" selected="">Recently updated</option>
<option value="name">Name A–Z</option>
<option value="created">Newest first</option>
</select>
</label>
</div>
<div class="flex flex-wrap items-center gap-2 px-4 py-3">
<ul aria-label="Active filters, 5" class="flex flex-wrap items-center gap-2">
<li>
<span class="inline-flex items-center gap-1.5 rounded-lg py-1 ps-2.5 text-sm pe-2.5 bg-muted/60 text-muted-foreground">
<span class="text-muted-foreground">Workspace:</span>
<span class="font-medium">Northwind</span>
</span>
</li>
<li>
<span class="inline-flex items-center gap-1.5 rounded-lg py-1 ps-2.5 text-sm pe-1 bg-muted text-foreground">
<span class="text-muted-foreground">Status:</span>
<span class="font-medium">Active</span>
<button type="button" class="rounded p-0.5 text-muted-foreground transition hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x h-3.5 w-3.5" aria-hidden="true">
<path d="M18 6 6 18"></path>
<path d="m6 6 12 12"></path>
</svg>
<span class="sr-only">Remove filter: Status is Active</span>
</button>
</span>
</li>
<li>
<span class="inline-flex items-center gap-1.5 rounded-lg py-1 ps-2.5 text-sm pe-1 bg-muted text-foreground">
<span class="text-muted-foreground">Owner:</span>
<span class="font-medium">Priya Raman</span>
<button type="button" class="rounded p-0.5 text-muted-foreground transition hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x h-3.5 w-3.5" aria-hidden="true">
<path d="M18 6 6 18"></path>
<path d="m6 6 12 12"></path>
</svg>
<span class="sr-only">Remove filter: Owner is Priya Raman</span>
</button>
</span>
</li>
<li>
<span class="inline-flex items-center gap-1.5 rounded-lg py-1 ps-2.5 text-sm pe-1 bg-muted text-foreground">
<span class="text-muted-foreground">Updated:</span>
<span class="font-medium">Last 30 days</span>
<button type="button" class="rounded p-0.5 text-muted-foreground transition hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x h-3.5 w-3.5" aria-hidden="true">
<path d="M18 6 6 18"></path>
<path d="m6 6 12 12"></path>
</svg>
<span class="sr-only">Remove filter: Updated is Last 30 days</span>
</button>
</span>
</li>
<li>
<span class="inline-flex items-center gap-1.5 rounded-lg py-1 ps-2.5 text-sm pe-1 bg-muted text-foreground">
<span class="text-muted-foreground">Tag:</span>
<span class="font-medium">billing</span>
<button type="button" class="rounded p-0.5 text-muted-foreground transition hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x h-3.5 w-3.5" aria-hidden="true">
<path d="M18 6 6 18"></path>
<path d="m6 6 12 12"></path>
</svg>
<span class="sr-only">Remove filter: Tag is billing</span>
</button>
</span>
</li>
</ul>
<button type="button" class="ms-1 rounded text-sm font-medium text-muted-foreground underline-offset-4 transition hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background">Clear all</button>
</div>
</div>
</section>
What each framework gets across the whole catalog — effects convert properly; this rung is markup.
The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.
Want the whole screen instead of this one section? Open a page and copy it entire.
All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.
Browse Command & SearchCopying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.
The ⌘K switcher done properly: focus stays in the input while aria-activedescendant moves, arrows wrap, and the highlight resets on every query change.
Results grouped by section with visible breadcrumb paths and <mark>-highlighted matches — users recognise where a result lives faster than they read its snippet.
The "?" overlay, with chords written once in one notation and rendered per platform — mod becomes Command on Apple and Ctrl everywhere else, decided after mount so the markup never mismatches.
The field in the header, not the palette over it: Enter searches for what you typed unless you arrowed to a suggestion, late responses are dropped by sequence number, and recent searches are removable one at a time.
Faceted search with result counts on every option, zero-count options kept visible and disabled so the list stays stable, and a note explaining why the counts do not sum.
One query counted across every scope it could have matched, as a real tablist with arrow-key movement — so an answer that is nowhere is visible without opening four tabs.
The empty state of a search box, filled with the searches that are worth repeating and the ones worth saving.
The whole faceted search assembled - rail, chips, live count and sort - with the intersection actually applied and relevance offered only when there is a query.
The facet that is a number: a distribution over a dual-thumb slider built from two real range inputs, with typed bounds clamped on blur rather than per keystroke.