Search
Implement document search in your docs
Fumadocs UI provides a good-looking search dialog out-of-the-box.
Open with ⌘ K or Ctrl K.
Search Dialog
You can customize the search dialog from Root Provider.
When not specified, it uses the Default Search Client powered by Flexsearch.
It is lazy loaded using next/dynamic
.
This allows a better initial loading performance.
Custom Links
Add custom link items to search dialog. They are shown as fallbacks when the query is empty.
Disable Search
To opt-out of document search, disable it from root provider.
Hot Keys
Customise the hot keys to trigger search dialog.
Tag Filter
Configure Tag Filter on the default search client.
Algolia
For the setup guide, see Integrate Algolia Search. Make sure you have algoliasearch
installed on your project.
While generally we recommend building your own search with their client-side SDK, you can also plug the built-in dialog interface.
Create a separate client component for the dialog.
Replace appId
, apiKey
and indexName
with your desired values.
Create a new provider component and use it instead of the original Root Provider in the root layout.
Inside the new provider, lazy load the dialog and pass it to Root Provider.
Note
The built-in implementation doesn't use instant search (their official javascript client).
Tag Filter
Same as the default search client, you can configure Tag Filter on the dialog.
Other Solutions
To use other search solutions such as ElasticSearch, you can replace the default dialog with your own.
Since you cannot pass a function to client components, wrap the provider in another client component, and use the new provider in your root layout instead.
Built-in UI
If you want to use the built-in search dialog UI instead of building your own,
you may use the SearchDialog
component.
Unstable
It is an internal API, might break during iterations
Last updated on