- Introduced multiple new MDX files covering various topics including comparisons, customization, internationalization, manual installation, markdown usage, and component documentation. - Enhanced the overall structure and organization of the documentation to improve user experience and accessibility. - Added a meta JSON file to define the documentation structure and navigation. - Implemented new layout files for different document types, improving the flexibility of the documentation framework.
53 lines
936 B
Plaintext
53 lines
936 B
Plaintext
---
|
|
title: 根提供者
|
|
description: Fumadocs UI 的上下文提供者
|
|
---
|
|
|
|
所有组件的上下文提供者,包括 `next-themes` 和搜索对话框的上下文。它应该位于根布局中。
|
|
|
|
## 使用方法
|
|
|
|
```jsx
|
|
import { RootProvider } from 'fumadocs-ui/provider';
|
|
|
|
export default function Layout({ children }) {
|
|
return (
|
|
<html lang="en">
|
|
<body>
|
|
<RootProvider>{children}</RootProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
```
|
|
|
|
### 搜索对话框
|
|
|
|
使用 `search` 选项自定义或禁用搜索对话框。
|
|
|
|
```jsx
|
|
<RootProvider
|
|
search={{
|
|
enabled: false,
|
|
}}
|
|
>
|
|
{children}
|
|
</RootProvider>
|
|
```
|
|
|
|
从[搜索](/docs/search)了解更多信息。
|
|
|
|
### 主题提供者
|
|
|
|
Fumadocs 通过 [`next-themes`](https://github.com/pacocoursey/next-themes) 支持明/暗模式。
|
|
使用 `theme` 选项自定义或禁用它。
|
|
|
|
```jsx
|
|
<RootProvider
|
|
theme={{
|
|
enabled: false,
|
|
}}
|
|
>
|
|
{children}
|
|
</RootProvider>
|
|
``` |