FrameworkSearch
Mixedbread
Using Mixedbread with Fumadocs UI.
Setup
- Integrate Mixedbread Search.
- Create a search dialog component.
'use client'; import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay, type SharedProps, } from '@hanzo/docs-ui/components/dialog/search'; import { useDocsSearch } from '@hanzo/docs-core/search/client'; import { useI18n } from '@hanzo/docs-ui/contexts/i18n'; export default function CustomSearchDialog(props: SharedProps) { const { locale } = useI18n(); // (optional) for i18n const { search, setSearch, query } = useDocsSearch({ type: 'fetch', api: '/api/search', locale, }); return ( <SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}> <SearchDialogOverlay /> <SearchDialogContent> <SearchDialogHeader> <SearchDialogIcon /> <SearchDialogInput /> <SearchDialogClose /> </SearchDialogHeader> <SearchDialogList items={query.data !== 'empty' ? query.data : null} /> <SearchDialogFooter> <a href="https://mixedbread.com" rel="noreferrer noopener" className="ms-auto text-xs text-fd-muted-foreground" > Search powered by Mixedbread </a> </SearchDialogFooter> </SearchDialogContent> </SearchDialog> ); }
Replace Search Dialog
Replace the search dialog with yours from <RootProvider />:
import { RootProvider } from '@hanzo/docs-ui/provider/<framework>';
import SearchDialog from '@/components/search';
<RootProvider
search={{
SearchDialog,
}}
>
{children}
</RootProvider>;If it was in a server component, you would need a separate client component for provider to pass functions:
'use client';
import { RootProvider } from '@hanzo/docs-ui/provider/<framework>';
import SearchDialog from '@/components/search';
import type { ReactNode } from 'react';
export function Provider({ children }: { children: ReactNode }) {
return (
<RootProvider
search={{
SearchDialog,
}}
>
{children}
</RootProvider>
);
}Tag Filter
Optionally, you can add UI for filtering results by tags. Configure Tag Filter on search server and add the following:
import { SearchDialog } from '@hanzo/docs-ui/dialog/search'
<SearchDialog />How is this guide?
Last updated on