# Fumadocs (Framework Mode, TanStack Start): Orama Cloud
URL: /zh-TW/docs/tanstack-start/search/orama-cloud
Source: https://raw.githubusercontent.com/fuma-nama/fumadocs/refs/heads/main/apps/docs/content/docs/(framework)/[framework]/search/orama-cloud.zh-TW.mdx

在 Fumadocs UI 中使用 Orama Cloud。

## 設定 [#setup]

Fumadocs CLI 可以幫您完成設定，它會建立搜尋對話方塊、`static.json` 路由，以及一個在每次建置後同步搜尋索引的指令碼：

```package-install
npx @fumadocs/cli feature search --provider orama-cloud
```

或手動設定：

1. 整合 [Orama Cloud](/docs/headless/search/orama-cloud)。

2. 建立搜尋對話方塊，並將 `endpoint` 與 `api_key` 替換為您要使用的值。

   ```tsx title="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';
   import { useI18n } from 'fumadocs-ui/contexts/i18n';

   const orama = new OramaCloud({
     projectId: '',
     apiKey: '',
   });

   export default function CustomSearchDialog(props: SharedProps) {
     const { locale } = useI18n(); // (optional) for i18n
     const search = useOramaCloudSearch({
       client: orama,
       locale,
     });

     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]

請在根路由中，將您的搜尋對話方塊傳入 [`<RootProvider />`](/docs/ui/layouts/root-provider)：

```tsx title="src/routes/__root.tsx"
import { createRootRoute, HeadContent, Outlet, Scripts } from '@tanstack/react-router';
import { RootProvider } from 'fumadocs-ui/provider/tanstack';
// [!code ++]
import SearchDialog from '@/components/search';

export const Route = createRootRoute({
  component: RootComponent,
});

function RootComponent() {
  return (
    <html suppressHydrationWarning>
      <head>
        <HeadContent />
      </head>
      <body className="flex flex-col min-h-screen">
        {/* [!code highlight] */}
        <RootProvider search={{ SearchDialog }}>
          <Outlet />
        </RootProvider>
        <Scripts />
      </body>
    </html>
  );
}
```