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.
import { RootProvider } from 'styledsea-docs-interface/root-provider';<RootProvider search={{ hotKey: [ { display: 'K', key: 'k', // key code, or a function determining whether the key is pressed }, ], }}> ...</RootProvider>;
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.
'use client';import { RootProvider } from 'styledsea-docs-interface/provider';import dynamic from 'next/dynamic';const SearchDialog = dynamic(() => import('@/components/search'));export function Provider({ children }: { children: React.ReactNode }) { return ( <RootProvider search={{ SearchDialog, }} > {children} </RootProvider> );}
If you want to use the built-in search dialog UI instead of building your own,
you may use the SearchDialog component.
import { SearchDialog, type SharedProps} from 'styledsea-docs-interface/components/dialog/search'export default function CustomSearchDialog(props: SharedProps) { ... }
Unstable
It is an internal API, might break during iterations