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
閱讀這份關於最小化 bundle 大小的指南,以了解差異。
原生元件的 props 也可使用。
名稱 | 類型 | 預設 | 描述 |
---|---|---|---|
children* | node | - | app provider 的內容。 |
authentication | { signIn: func, signOut: func } | null | 驗證方法。 |
branding | { homeUrl?: string, logo?: node, title?: string } | null | app 的品牌選項。 |
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' }> | [] | app 的導航定義。 了解更多。 |
router | { Link?: func, navigate: func, pathname: string, searchParams: URLSearchParams } | null | Toolpad 元件內部使用的路由器實作。 |
session | { user?: { email?: string, id?: string, image?: string, name?: string } } | null | 關於目前使用者的 Session 資訊。 |
theme | object | createTheme() | |
window | object | window | 應用程式呈現所在的 window。例如,在 iframe 內呈現 app 時需要此項。 |
元件無法持有 ref。
原始碼
如果您在本頁中找不到資訊,請考慮查看元件的實作以取得更多詳細資訊。