跳到内容
跳到内容

AppProviderAPI

React AppProvider 组件的 API 参考文档。了解此导出模块的 props、CSS 和其他 API。

演示

导入

import { AppProvider } from '@toolpad/core/AppProvider';
// or
import { AppProvider } from '@toolpad/core';
import { NextAppProvider } from '@toolpad/core/nextjs'; // Next.js
import { ReactRouterAppProvider } from '@toolpad/core/react-router'; // React Router

通过阅读关于最小化捆绑包大小的指南,了解其差异。

Props

原生组件的 Props 也可用。

名称类型默认值描述
children*node-

应用提供器的内容。

authentication{ signIn: func, signOut: func }null

身份验证方法。

branding{ homeUrl?: string, logo?: node, title?: string }null

应用的品牌选项。

localeTextobject-

组件的本地文本

navigationArray<{ action?: node, children?: Array<object
| { kind: 'header', title: string }
| { kind: 'divider' }>, icon?: node, kind?: 'page', pattern?: string, segment?: string, title?: string }
| { kind: 'header', title: string }
| { kind: 'divider' }>
[]

应用的导航定义。了解更多

router{ Link?: func, navigate: func, pathname: string, searchParams: URLSearchParams }null

Toolpad 组件内部使用的路由实现。

session{ user?: { email?: string, id?: string, image?: string, name?: string } }null

关于当前用户的会话信息。

themeobjectcreateTheme()

主题或多个主题,供应用在亮/暗模式下使用。 推荐使用 CSS 变量主题

windowobjectwindow

渲染应用程序的窗口。 例如,在 iframe 中渲染应用程序时,这是必需的。

该组件无法持有 ref。

源代码

如果您在此页面中没有找到所需信息,请考虑查看组件的实现以获取更多详细信息。