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 也可用。
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
children* | node | - | 应用提供器的内容。 |
authentication | { signIn: func, signOut: func } | null | 身份验证方法。 |
branding | { homeUrl?: string, logo?: node, title?: string } | null | 应用的品牌选项。 |
localeText | object | - | 组件的本地文本 |
navigation | Array<{ 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 | 关于当前用户的会话信息。 |
theme | object | createTheme() | |
window | object | window | 渲染应用程序的窗口。 例如,在 iframe 中渲染应用程序时,这是必需的。 |
该组件无法持有 ref。
源代码
如果您在此页面中没有找到所需信息,请考虑查看组件的实现以获取更多详细信息。