Fumadocs rebuilt on Hamur, the original is fumadocs.dev
Skip to Content
Fumadocs

Orama Cloud

Using Orama Cloud with Fumadocs UI.

Setup

Fumadocs CLI can set it up for you, it creates the search dialog, the static.json route and a script to sync the search index after each build:

npx @fumadocs/cli feature search --provider orama-cloud

Or manually:

  1. Integrate Orama Cloud.

  2. Create a search dialog, replace endpoint and api_key with your desired values.

    components/search.tsx
    'use client';
    
    import {
      SearchDialog,
      SearchDialogClose,
      SearchDialogContent,
      SearchDialogFooter,
      SearchDialogHeader,
      SearchDialogIcon,
      SearchDialogInput,
      SearchDialogList,
      SearchDialogOverlay,
      type SharedProps,
    } from 'fumadocs-ui/components/dialog/search';
    import { useOramaCloudSearch } from 'fumadocs-core/search/client';
    import { OramaCloud } from '@orama/core';
    
    const orama = new OramaCloud({
      projectId: '',
      apiKey: '',
    });
    
    export default function CustomSearchDialog(props: SharedProps) {
      const search = useOramaCloudSearch({
        client: orama,
      });
    
      return (
        <SearchDialog {...search} {...props}>
          <SearchDialogOverlay />
          <SearchDialogContent>
            <SearchDialogHeader>
              <SearchDialogIcon />
              <SearchDialogInput />
              <SearchDialogClose />
            </SearchDialogHeader>
            <SearchDialogList />
            <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

Pass your search dialog to <RootProvider /> in your provider component:

src/components/provider.tsx
'use client';
import type { ReactNode } from 'react';
import { RootProvider } from 'fumadocs-ui/provider/waku';
import SearchDialog from '@/components/search';

export function Provider({ children }: { children: ReactNode }) {
  return <RootProvider search={{ SearchDialog }}>{children}</RootProvider>;
}

How is this guide?

Last updated on