Orama Cloud
Using Orama Cloud with Fumadocs UI.
Setup
For the setup guide, see Integrate Orama Cloud.
Create a search dialog, replace endpoint
and api_key
with your desired values.
'use client';
import {
SearchDialog,
SearchDialogClose,
SearchDialogContent,
SearchDialogFooter,
SearchDialogHeader,
SearchDialogIcon,
SearchDialogInput,
SearchDialogList,
SearchDialogOverlay,
type SharedProps,
} from 'fumadocs-ui/components/dialog/search';
import { useDocsSearch } from 'fumadocs-core/search/client';
import { OramaClient } from '@oramacloud/client';
import { useI18n } from 'fumadocs-ui/contexts/i18n';
const client = new OramaClient({
endpoint: 'Endpoint URL',
api_key: 'API Key',
});
export default function CustomSearchDialog(props: SharedProps) {
const { locale } = useI18n(); // (optional) for i18n
const { search, setSearch, query } = useDocsSearch({
type: 'orama-cloud',
client,
locale,
});
return (
<SearchDialog
search={search}
onSearchChange={setSearch}
isLoading={query.isLoading}
{...props}
>
<SearchDialogOverlay />
<SearchDialogContent>
<SearchDialogHeader>
<SearchDialogIcon />
<SearchDialogInput />
<SearchDialogClose />
</SearchDialogHeader>
{query.data !== 'empty' && query.data && (
<SearchDialogList items={query.data} />
)}
<SearchDialogFooter>
<a
href="https://orama.com"
rel="noreferrer noopener"
className="ms-auto text-xs text-fd-muted-foreground"
>
Search powered by Orama
</a>
</SearchDialogFooter>
</SearchDialogContent>
</SearchDialog>
);
}
Replace Search Dialog
To use your own search dialog, make a client-side <RootProvider />
wrapper, and replace the original root provider with it.
'use client';
import { RootProvider } from 'fumadocs-ui/provider';
// your custom dialog
import SearchDialog from '@/components/search';
import type { ReactNode } from 'react';
export function Provider({ children }: { children: ReactNode }) {
return (
<RootProvider
search={{
SearchDialog,
}}
>
{children}
</RootProvider>
);
}
import { Provider } from './provider';
import type { ReactNode } from 'react';
export default function Layout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
<Provider>{children}</Provider>
</body>
</html>
);
}
How is this guide?
Last updated on