Zero Result Rescue

Zero Result Rescue is a copy-paste React component that stops users quit on empty search results before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/zero-result-rescue
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsUsers quit on empty search results

Was this component page useful?

How do I install Zero Result Rescue?

pnpm dlx shadcn@latest add @bollard/zero-result-rescue

The files land in your project. They're yours to edit.

How do I use Zero Result Rescue in React?

zero-result-rescue-usage.tsx
import { ZeroResultRescue, type SearchAttempt } from "@/components/ui/zero-result-rescue"

<ZeroResultRescue
  query={query}
  filters={filters}
  scope={allCategories ? undefined : category}
  vocabulary={vocabulary}
  count={count}
  onRescue={(attempt) => {
    setQuery(attempt.query)
    setBudgetOn(attempt.filters.includes(budget.id))
    setAllCategories(allCategories || attempt.allCategories)
  }}
/>

What input mistakes does Zero Result Rescue catch?

  • Misspellings against your own vocabulary
  • Wrong keyboard layout and Caps Lock
  • The single filter that hides every result
  • A category scope that's too narrow
  • Only fixes with a non-zero count are shown

What props does Zero Result Rescue accept?

ZeroResultRescue props
PropTypeDefault
query* (required)

The query that returned nothing.

string—
filters

Filters applied to that search.

ActiveSearchFilter[][]
scope

The category the search was limited to, if any.

string—
vocabulary

Words your catalog knows (product names, brands, categories), used for "did you mean".

string[][]
layouts

Keyboard layouts to try when the query looks typed with the wrong one.

KeyboardLayout[]DEFAULT_LAYOUTS
count* (required)

Returns how many results an attempt would give, or a promise of it (a count-only API call). Called once per candidate fix, all at once; the signal aborts when the query changes. A rejected count just drops that fix.

(attempt: SearchAttempt, signal: AbortSignal) => number | Promise<number>—
onRescue* (required)

Run the chosen fix.

(attempt: SearchAttempt, rescue: Rescue) => void—
limit

Most fixes to offer.

number3
titleText

Templates: `{query}`, `{scope}`, `{filters}`, `{count}`, `{filter}`, `{layout}`, `{from}`, `{to}` are filled in.

string"No results for “{query}”"
scopeText

Text naming the current category scope.

string"in {scope}"
searchLabel

Label prefix of a search-instead fix.

string"Search “{query}”"
withoutLabel

Label prefix of a remove-filter fix.

string"without {filter}"
allCategoriesLabel

Label of the search-all-categories fix.

string"in all categories"
spellingReason

Reason shown for a spelling fix.

string"“{from}” looks like “{to}”"
layoutReason

Reason shown for a keyboard-layout fix.

string"typed with the {layout} keyboard layout"
capsReason

Reason shown for a Caps Lock fix.

string"Caps Lock looks on"
filterReason

Reason shown for a filter fix.

string"{filter} hides every match"
scopeReason

Reason shown for a category fix.

string"nothing in {scope}"
fallbackText

Shown when no single change brings results back.

string"Nothing close turned up. Try fewer or more general words."
formatCount

Formats a result count.

(count: number) => stringdefaultCount
filtersText

"1 filter" / "2 filters" under the title.

(count: number) => string(n) => `${n} ${n === 1 ? "filter" : "filters"}`
checkingText

Shown while async counts are coming in.

string"Looking for close matches…"
countKey

Fixes are recounted when the query, filters, scope, vocabulary or layouts change; change this too when the data behind `count` does.

string | number—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Zero Result Rescue accessible?

  • Region is role=status with aria-busy while counting
  • Fix buttons include their reason and count as text
  • Icons are aria-hidden

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Counts come from your count function; slow APIs delay suggestions
  • Did-you-mean is limited to the vocabulary you pass

What expensive mistakes does Zero Result Rescue stop?

Users quit on empty search results

Also known as

no results · empty state · search · did you mean · zero results · filters · search page · ecommerce search

Field type

What dependencies does Zero Result Rescue require?

Zero Result Rescue facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameZero Result Rescue
Registry identifier@bollard/zero-result-rescue
Install commandnpx shadcn@latest add @bollard/zero-result-rescue
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Zero Result Rescue

How does Zero Result Rescue prevent financial transaction errors?

Zero Result Rescue prevents users quit on empty search results. Blocks Misspellings against your own vocabulary, Wrong keyboard layout and Caps Lock, The single filter that hides every result, A category scope that's too narrow, Only fixes with a non-zero count are shown before processing. Limitation: apply idempotency keys for zero-result-rescue.

How do I install zero-result-rescue with shadcn?

Run `npx shadcn@latest add @bollard/zero-result-rescue`. Sources added: registry/default/zero-result-rescue/rescue.ts, registry/default/zero-result-rescue/zero-result-rescue.tsx. Package requirements: lucide-react.

What props customize Zero Result Rescue?

Zero Result Rescue accepts `query`, `filters`, `scope`, `vocabulary`, `layouts`. Configures no results, empty state, search behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of zero-result-rescue?

Counts come from your count function; slow APIs delay suggestions. Did-you-mean is limited to the vocabulary you pass Server requirement: backend verification for zero-result-rescue.

How does Zero Result Rescue meet accessibility guidelines?

Region is role=status with aria-busy while counting. Fix buttons include their reason and count as text. Icons are aria-hidden. Minimizes errors: no results found search, search empty state.

Which components pair with Zero Result Rescue?