Components/Search results

Search results

A search results page with filters, paging, and an empty state.

Since 0.9.3BETA

Usage

Search results

Debounced search, type and date filters, paging, and an empty state. Sample data.

Loading demo...

Overview

A results page for Tuff docs, plugins, and changelogs. One search field sits on top, type and date filters narrow the set, and paged results list the newest first with keywords highlighted.

  • Results update about 220 ms after typing, debounced by the search field itself. Enter searches at once, and clearing the field restores every result.
  • Counts on the type chips follow the keyword and the date range, not the chosen type, so the kinds can be compared.
  • Any change to the keyword, type, or date returns to page one. With no match, an empty state offers Clear filters to reset everything at once.
  • With focus inside the template, ⌘K and / focus this template's search field instead of opening the site search.
  • Expanded (≥ 960px), results form two columns. Below 640px, metadata wraps and summaries stay at two lines.

Customization

  • For a real index, replace the local array with API results. Send the keyword, type, and date together, and move paging to the server.
  • Tune search-debounce to the source. A local array can use a shorter delay. A remote API can use a longer one and cancel the previous request when a new one starts.
  • Derive chip counts from the results instead of hard-coding them. With many types, switch to a select so the chips do not wrap.
  • Highlighting splits plain text only. Do not build results into v-html. For rich summaries, sanitize first and render through TxMarkdownView.
RegionComponentsRole
Search fieldTxSearchInputDebounced remote search, Enter to search, and clear
Type and date filtersTxFilterChipsTwo single-select chip rows, with counts on types
Empty stateTxSearchEmptyNo-result message and one-step filter reset
PaginationTxPaginationPaging, kept in step with the total