Search @ngb-bootstrap/core/search

<ngb-search>Component

NgbSearch

A search dialog in the style of Taiga UI's docs search: a button that opens a modal with a search field, results as you type, and the user's Recent and Favorites before they type. The app finds the results ( search ); the component draws them, handles the keyboard and remembers what was opened. Ctrl K (⌘K on Apple devices) opens it from anywhere on the page. The field is a WAI-ARIA combobox whose results are a listbox: ↑ and ↓ move the highlight, Enter opens the highlighted result and Escape closes. Ctrl D (⌘D) saves the highlighted result to Favorites or removes it, Delete removes a saved one; the row buttons do the same with a mouse. Recent and Favorites live in localStorage under storageKey .

<ngb-search [search]="find" placeholder="Search docs" storageKey="my-docs-search" />
NameTypeDefault
[search]required
Finds the results for a query.
NgbSearchFn—
[label]
Text of the button and the dialog's accessible name. Defaults to the search.label string.
string—
[placeholder]
Placeholder of the search field. Defaults to the search.placeholder string.
string—
[storageKey]
The localStorage key under which Recent and Favorites are kept.
string'ngb-search'
[recentLimit]
How many recently opened results are kept.
number8
[hotkey]
Whether Ctrl K (⌘K) opens the dialog.
booleantrue
(selected)
Emits the result the user opened, before the app navigates to it.
NgbSearchResult—

NgbSearchFnType

Finds the results for a query. It is called with the trimmed query on every change, so a search that goes over the network should debounce or cancel by itself; an answer that arrives after a newer query is ignored.

type NgbSearchFn = ( query: string, ) => readonly NgbSearchResult[] | PromiseLike<readonly NgbSearchResult[]>

NgbSearchResultInterface

One result of a search: where it leads and how it reads.

NameTypeDefault
titlerequired
First line of the row, e.g. a page or heading. Words matching the query are highlighted.
string—
section
Second line: where the result is, e.g. Components › Buttons .
string—
linkrequired
Where choosing the result goes: a router URL (which may carry a #fragment or a query), or an absolute URL, which is opened with a full page load.
string—
group
Results with the same group are listed together under it, in the order they first appear.
string—
© 2026 The ngb-bootstrap authors · Apache-2.0