diff --git a/docs/data/toolpad/core/components/app-provider/AppProviderBasic.js b/docs/data/toolpad/core/components/app-provider/AppProviderBasic.js
index 3ed2c822614..36aa6e20c6f 100644
--- a/docs/data/toolpad/core/components/app-provider/AppProviderBasic.js
+++ b/docs/data/toolpad/core/components/app-provider/AppProviderBasic.js
@@ -7,7 +7,7 @@ import DashboardIcon from '@mui/icons-material/Dashboard';
import TimelineIcon from '@mui/icons-material/Timeline';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -71,18 +71,21 @@ function AppProviderBasic(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/app-provider/AppProviderBasic.tsx b/docs/data/toolpad/core/components/app-provider/AppProviderBasic.tsx
index 6d8fb9b3a5f..4a400a3b988 100644
--- a/docs/data/toolpad/core/components/app-provider/AppProviderBasic.tsx
+++ b/docs/data/toolpad/core/components/app-provider/AppProviderBasic.tsx
@@ -6,7 +6,7 @@ import DashboardIcon from '@mui/icons-material/Dashboard';
import TimelineIcon from '@mui/icons-material/Timeline';
import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -74,17 +74,20 @@ export default function AppProviderBasic(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/app-provider/AppProviderTheme.js b/docs/data/toolpad/core/components/app-provider/AppProviderTheme.js
index c064cf711be..1cbb963cf33 100644
--- a/docs/data/toolpad/core/components/app-provider/AppProviderTheme.js
+++ b/docs/data/toolpad/core/components/app-provider/AppProviderTheme.js
@@ -7,7 +7,7 @@ import DashboardIcon from '@mui/icons-material/Dashboard';
import TimelineIcon from '@mui/icons-material/Timeline';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -88,18 +88,21 @@ function AppProviderTheme(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/app-provider/AppProviderTheme.tsx b/docs/data/toolpad/core/components/app-provider/AppProviderTheme.tsx
index d6a772be78c..5548ee39d9d 100644
--- a/docs/data/toolpad/core/components/app-provider/AppProviderTheme.tsx
+++ b/docs/data/toolpad/core/components/app-provider/AppProviderTheme.tsx
@@ -6,7 +6,7 @@ import DashboardIcon from '@mui/icons-material/Dashboard';
import TimelineIcon from '@mui/icons-material/Timeline';
import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -91,17 +91,20 @@ export default function AppProviderTheme(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudAdvanced.js b/docs/data/toolpad/core/components/crud/CrudAdvanced.js
index 7fd30bf777c..05cca6d443d 100644
--- a/docs/data/toolpad/core/components/crud/CrudAdvanced.js
+++ b/docs/data/toolpad/core/components/crud/CrudAdvanced.js
@@ -13,7 +13,7 @@ import {
List,
Show,
} from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -273,46 +273,49 @@ function CrudAdvanced(props) {
const editNoteId = matchPath(editPath, router.pathname);
return (
-
-
-
- {/* preview-start */}
-
- {router.pathname === listPath ? (
-
- ) : null}
- {router.pathname === createPath ? (
-
- ) : null}
- {router.pathname !== createPath && showNoteId ? (
-
- ) : null}
- {editNoteId ? (
-
- ) : null}
-
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ {router.pathname === listPath ? (
+
+ ) : null}
+ {router.pathname === createPath ? (
+
+ ) : null}
+ {router.pathname !== createPath && showNoteId ? (
+
+ ) : null}
+ {editNoteId ? (
+
+ ) : null}
+
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudAdvanced.tsx b/docs/data/toolpad/core/components/crud/CrudAdvanced.tsx
index cee3b21d0e2..1de9755f0d0 100644
--- a/docs/data/toolpad/core/components/crud/CrudAdvanced.tsx
+++ b/docs/data/toolpad/core/components/crud/CrudAdvanced.tsx
@@ -14,7 +14,7 @@ import {
List,
Show,
} from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -294,48 +294,51 @@ export default function CrudAdvanced(props: DemoProps) {
const editNoteId = matchPath(editPath, router.pathname);
return (
-
-
-
- {/* preview-start */}
-
- dataSource={notesDataSource}
- dataSourceCache={notesCache}
- >
- {router.pathname === listPath ? (
-
- initialPageSize={10}
- onRowClick={handleRowClick}
- onCreateClick={handleCreateClick}
- onEditClick={handleEditClick}
- />
- ) : null}
- {router.pathname === createPath ? (
-
- initialValues={{ title: 'New note' }}
- onSubmitSuccess={handleCreate}
- resetOnSubmit={false}
- />
- ) : null}
- {router.pathname !== createPath && showNoteId ? (
-
- id={showNoteId}
- onEditClick={handleEditClick}
- onDelete={handleDelete}
- />
- ) : null}
- {editNoteId ? (
- id={editNoteId} onSubmitSuccess={handleEdit} />
- ) : null}
-
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ dataSource={notesDataSource}
+ dataSourceCache={notesCache}
+ >
+ {router.pathname === listPath ? (
+
+ initialPageSize={10}
+ onRowClick={handleRowClick}
+ onCreateClick={handleCreateClick}
+ onEditClick={handleEditClick}
+ />
+ ) : null}
+ {router.pathname === createPath ? (
+
+ initialValues={{ title: 'New note' }}
+ onSubmitSuccess={handleCreate}
+ resetOnSubmit={false}
+ />
+ ) : null}
+ {router.pathname !== createPath && showNoteId ? (
+
+ id={showNoteId}
+ onEditClick={handleEditClick}
+ onDelete={handleDelete}
+ />
+ ) : null}
+ {editNoteId ? (
+ id={editNoteId} onSubmitSuccess={handleEdit} />
+ ) : null}
+
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudBasic.js b/docs/data/toolpad/core/components/crud/CrudBasic.js
index 00f12c47456..289a751a521 100644
--- a/docs/data/toolpad/core/components/crud/CrudBasic.js
+++ b/docs/data/toolpad/core/components/crud/CrudBasic.js
@@ -6,7 +6,7 @@ import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { Crud, DataSourceCache } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -228,26 +228,29 @@ function CrudBasic(props) {
}, [router.pathname]);
return (
-
-
-
- {/* preview-start */}
-
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudBasic.tsx b/docs/data/toolpad/core/components/crud/CrudBasic.tsx
index e58449d51f5..0f1c726c621 100644
--- a/docs/data/toolpad/core/components/crud/CrudBasic.tsx
+++ b/docs/data/toolpad/core/components/crud/CrudBasic.tsx
@@ -5,7 +5,7 @@ import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { Crud, DataModel, DataSource, DataSourceCache } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -247,25 +247,28 @@ export default function CrudBasic(props: DemoProps) {
}, [router.pathname]);
return (
-
-
-
- {/* preview-start */}
-
- dataSource={notesDataSource}
- dataSourceCache={notesCache}
- rootPath="/notes"
- initialPageSize={10}
- defaultValues={{ title: 'New note' }}
- />
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ dataSource={notesDataSource}
+ dataSourceCache={notesCache}
+ rootPath="/notes"
+ initialPageSize={10}
+ defaultValues={{ title: 'New note' }}
+ />
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudCreate.js b/docs/data/toolpad/core/components/crud/CrudCreate.js
index 44754879de1..489584269f4 100644
--- a/docs/data/toolpad/core/components/crud/CrudCreate.js
+++ b/docs/data/toolpad/core/components/crud/CrudCreate.js
@@ -6,7 +6,7 @@ import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { Create, DataSourceCache } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -115,26 +115,29 @@ function CrudCreate(props) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudCreate.tsx b/docs/data/toolpad/core/components/crud/CrudCreate.tsx
index 3e331d1133f..cfb197c6404 100644
--- a/docs/data/toolpad/core/components/crud/CrudCreate.tsx
+++ b/docs/data/toolpad/core/components/crud/CrudCreate.tsx
@@ -5,7 +5,7 @@ import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { DataModel, DataSource, Create, DataSourceCache } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -130,25 +130,28 @@ export default function CrudCreate(props: DemoProps) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- dataSource={peopleDataSource}
- dataSourceCache={peopleCache}
- initialValues={{ age: 18 }}
- onSubmitSuccess={handleSubmitSuccess}
- resetOnSubmit
- />
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ dataSource={peopleDataSource}
+ dataSourceCache={peopleCache}
+ initialValues={{ age: 18 }}
+ onSubmitSuccess={handleSubmitSuccess}
+ resetOnSubmit
+ />
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudEdit.js b/docs/data/toolpad/core/components/crud/CrudEdit.js
index d386ba38f27..6f99b53fe9a 100644
--- a/docs/data/toolpad/core/components/crud/CrudEdit.js
+++ b/docs/data/toolpad/core/components/crud/CrudEdit.js
@@ -6,7 +6,7 @@ import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { DataSourceCache, Edit } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -136,25 +136,28 @@ function CrudEdit(props) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudEdit.tsx b/docs/data/toolpad/core/components/crud/CrudEdit.tsx
index 29cbbf7faae..752a326513e 100644
--- a/docs/data/toolpad/core/components/crud/CrudEdit.tsx
+++ b/docs/data/toolpad/core/components/crud/CrudEdit.tsx
@@ -5,7 +5,7 @@ import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { DataModel, DataSource, DataSourceCache, Edit } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -151,24 +151,27 @@ export default function CrudEdit(props: DemoProps) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- id={1}
- dataSource={peopleDataSource}
- dataSourceCache={peopleCache}
- onSubmitSuccess={handleSubmitSuccess}
- />
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ id={1}
+ dataSource={peopleDataSource}
+ dataSourceCache={peopleCache}
+ onSubmitSuccess={handleSubmitSuccess}
+ />
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudList.js b/docs/data/toolpad/core/components/crud/CrudList.js
index 4b698e18e71..a0fea33c1e5 100644
--- a/docs/data/toolpad/core/components/crud/CrudList.js
+++ b/docs/data/toolpad/core/components/crud/CrudList.js
@@ -6,7 +6,7 @@ import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { DataSourceCache, List } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -166,28 +166,31 @@ function CrudList(props) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudList.tsx b/docs/data/toolpad/core/components/crud/CrudList.tsx
index eb945970443..e751702611d 100644
--- a/docs/data/toolpad/core/components/crud/CrudList.tsx
+++ b/docs/data/toolpad/core/components/crud/CrudList.tsx
@@ -5,7 +5,7 @@ import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { DataModel, DataSource, DataSourceCache, List } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -181,27 +181,30 @@ export default function CrudList(props: DemoProps) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- dataSource={peopleDataSource}
- dataSourceCache={peopleCache}
- initialPageSize={4}
- onRowClick={handleRowClick}
- onCreateClick={handleCreateClick}
- onEditClick={handleEditClick}
- onDelete={handleDelete}
- />
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ dataSource={peopleDataSource}
+ dataSourceCache={peopleCache}
+ initialPageSize={4}
+ onRowClick={handleRowClick}
+ onCreateClick={handleCreateClick}
+ onEditClick={handleEditClick}
+ onDelete={handleDelete}
+ />
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudListDataGrid.js b/docs/data/toolpad/core/components/crud/CrudListDataGrid.js
index ad8bdd1be44..1e1616ae8f5 100644
--- a/docs/data/toolpad/core/components/crud/CrudListDataGrid.js
+++ b/docs/data/toolpad/core/components/crud/CrudListDataGrid.js
@@ -7,7 +7,7 @@ import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { DataSourceCache, List } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -136,32 +136,37 @@ function CrudListDataGrid(props) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudListDataGrid.tsx b/docs/data/toolpad/core/components/crud/CrudListDataGrid.tsx
index f3028b263dc..5e98a36981d 100644
--- a/docs/data/toolpad/core/components/crud/CrudListDataGrid.tsx
+++ b/docs/data/toolpad/core/components/crud/CrudListDataGrid.tsx
@@ -6,7 +6,7 @@ import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { DataModel, DataSource, DataSourceCache, List } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -146,31 +146,36 @@ export default function CrudListDataGrid(props: DemoProps) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- dataSource={peopleDataSource}
- dataSourceCache={peopleCache}
- initialPageSize={4}
- onRowClick={handleRowClick}
- onCreateClick={handleCreateClick}
- onEditClick={handleEditClick}
- onDelete={handleDelete}
- slots={{ dataGrid: DataGridPro }}
- slotProps={{
- dataGrid: { initialState: { pinnedColumns: { right: ['actions'] } } },
- }}
- />
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ dataSource={peopleDataSource}
+ dataSourceCache={peopleCache}
+ initialPageSize={4}
+ onRowClick={handleRowClick}
+ onCreateClick={handleCreateClick}
+ onEditClick={handleEditClick}
+ onDelete={handleDelete}
+ slots={{ dataGrid: DataGridPro }}
+ slotProps={{
+ dataGrid: {
+ initialState: { pinnedColumns: { right: ['actions'] } },
+ },
+ }}
+ />
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudListDataGrid.tsx.preview b/docs/data/toolpad/core/components/crud/CrudListDataGrid.tsx.preview
index 8b29f127784..1759560abc7 100644
--- a/docs/data/toolpad/core/components/crud/CrudListDataGrid.tsx.preview
+++ b/docs/data/toolpad/core/components/crud/CrudListDataGrid.tsx.preview
@@ -8,6 +8,8 @@
onDelete={handleDelete}
slots={{ dataGrid: DataGridPro }}
slotProps={{
- dataGrid: { initialState: { pinnedColumns: { right: ['actions'] } } },
+ dataGrid: {
+ initialState: { pinnedColumns: { right: ['actions'] } },
+ },
}}
/>
\ No newline at end of file
diff --git a/docs/data/toolpad/core/components/crud/CrudNoCache.js b/docs/data/toolpad/core/components/crud/CrudNoCache.js
index c227be51f98..a6b4b3764ff 100644
--- a/docs/data/toolpad/core/components/crud/CrudNoCache.js
+++ b/docs/data/toolpad/core/components/crud/CrudNoCache.js
@@ -6,7 +6,7 @@ import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { Crud } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -224,26 +224,29 @@ function CrudNoCache(props) {
}, [router.pathname]);
return (
-
-
-
- {/* preview-start */}
-
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudNoCache.tsx b/docs/data/toolpad/core/components/crud/CrudNoCache.tsx
index 68f60fca44d..f6737901ec3 100644
--- a/docs/data/toolpad/core/components/crud/CrudNoCache.tsx
+++ b/docs/data/toolpad/core/components/crud/CrudNoCache.tsx
@@ -5,7 +5,7 @@ import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { Crud, DataModel, DataSource } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -237,25 +237,28 @@ export default function CrudNoCache(props: DemoProps) {
}, [router.pathname]);
return (
-
-
-
- {/* preview-start */}
-
- dataSource={notesDataSource}
- dataSourceCache={null}
- rootPath="/notes"
- initialPageSize={10}
- defaultValues={{ title: 'New note' }}
- />
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ dataSource={notesDataSource}
+ dataSourceCache={null}
+ rootPath="/notes"
+ initialPageSize={10}
+ defaultValues={{ title: 'New note' }}
+ />
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudShow.js b/docs/data/toolpad/core/components/crud/CrudShow.js
index 43ebcb39dbd..722ed76b57a 100644
--- a/docs/data/toolpad/core/components/crud/CrudShow.js
+++ b/docs/data/toolpad/core/components/crud/CrudShow.js
@@ -6,7 +6,7 @@ import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { DataSourceCache, Show } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -104,26 +104,29 @@ function CrudShow(props) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/crud/CrudShow.tsx b/docs/data/toolpad/core/components/crud/CrudShow.tsx
index d0b2ac9e871..5942051f23f 100644
--- a/docs/data/toolpad/core/components/crud/CrudShow.tsx
+++ b/docs/data/toolpad/core/components/crud/CrudShow.tsx
@@ -5,7 +5,7 @@ import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { DataModel, DataSource, DataSourceCache, Show } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -119,25 +119,28 @@ export default function CrudShow(props: DemoProps) {
}, []);
return (
-
-
-
- {/* preview-start */}
-
- id={1}
- dataSource={peopleDataSource}
- dataSourceCache={peopleCache}
- onEditClick={handleEditClick}
- onDelete={handleDelete}
- />
- {/* preview-end */}
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+ {/* preview-start */}
+
+ id={1}
+ dataSource={peopleDataSource}
+ dataSourceCache={peopleCache}
+ onEditClick={handleEditClick}
+ onDelete={handleDelete}
+ />
+ {/* preview-end */}
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccount.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccount.js
index 27d0b93c54e..c9485144c72 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccount.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccount.js
@@ -6,7 +6,7 @@ import { createTheme } from '@mui/material/styles';
import DashboardIcon from '@mui/icons-material/Dashboard';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -86,20 +86,23 @@ function DashboardLayoutAccount(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccount.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccount.tsx
index 6439a2498fd..234fde2e500 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccount.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccount.tsx
@@ -9,7 +9,7 @@ import {
type Navigation,
} from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -93,19 +93,22 @@ export default function DashboardLayoutAccount(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccountSidebar.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccountSidebar.js
index 1ee1fc58259..66e996bc4cc 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccountSidebar.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccountSidebar.js
@@ -21,6 +21,8 @@ import {
SignOutButton,
} from '@toolpad/core/Account';
+import { DemoProvider } from '@toolpad/core/internal';
+
const NAVIGATION = [
{
kind: 'header',
@@ -267,20 +269,25 @@ function DashboardLayoutAccountSidebar(props) {
}, []);
return (
-
- null, sidebarFooter: SidebarFooterAccount }}
+ // Remove this provider when copying and pasting into your project.
+
+
-
-
-
+ {/* preview-start */}
+ null, sidebarFooter: SidebarFooterAccount }}
+ >
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccountSidebar.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccountSidebar.tsx
index ba82b95c2c2..78ab570494d 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccountSidebar.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutAccountSidebar.tsx
@@ -21,6 +21,7 @@ import {
AccountPreviewProps,
} from '@toolpad/core/Account';
import type { Navigation, Router, Session } from '@toolpad/core/AppProvider';
+import { DemoProvider } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -254,19 +255,24 @@ export default function DashboardLayoutAccountSidebar(props: DemoProps) {
}, []);
return (
-
- null, sidebarFooter: SidebarFooterAccount }}
+ // Remove this provider when copying and pasting into your project.
+
+
-
-
-
+ {/* preview-start */}
+ null, sidebarFooter: SidebarFooterAccount }}
+ >
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBasic.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBasic.js
index e403954223a..2cff4b90ccf 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBasic.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBasic.js
@@ -10,7 +10,7 @@ import DescriptionIcon from '@mui/icons-material/Description';
import LayersIcon from '@mui/icons-material/Layers';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -103,18 +103,21 @@ function DashboardLayoutBasic(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBasic.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBasic.tsx
index b8ec5f9b01d..53c88fa4b8f 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBasic.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBasic.tsx
@@ -9,7 +9,7 @@ import DescriptionIcon from '@mui/icons-material/Description';
import LayersIcon from '@mui/icons-material/Layers';
import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -106,17 +106,20 @@ export default function DashboardLayoutBasic(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBranding.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBranding.js
index 82f06a76bb0..b641bafeac0 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBranding.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBranding.js
@@ -7,7 +7,7 @@ import DashboardIcon from '@mui/icons-material/Dashboard';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -67,23 +67,26 @@ function DashboardLayoutBranding(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- title: 'MUI',
- homeUrl: '/toolpad/core/introduction',
- }}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ title: 'MUI',
+ homeUrl: '/toolpad/core/introduction',
+ }}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBranding.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBranding.tsx
index 804d9c7ece1..a5cee58912f 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBranding.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBranding.tsx
@@ -6,7 +6,7 @@ import DashboardIcon from '@mui/icons-material/Dashboard';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -70,22 +70,25 @@ export default function DashboardLayoutBranding(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- title: 'MUI',
- homeUrl: '/toolpad/core/introduction',
- }}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ title: 'MUI',
+ homeUrl: '/toolpad/core/introduction',
+ }}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutCustomThemeSwitcher.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutCustomThemeSwitcher.js
index bc46d147d7d..149bf92fd22 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutCustomThemeSwitcher.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutCustomThemeSwitcher.js
@@ -16,7 +16,7 @@ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import SettingsIcon from '@mui/icons-material/Settings';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -140,20 +140,25 @@ function DashboardLayoutCustomThemeSwitcher(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
+
-
-
-
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutCustomThemeSwitcher.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutCustomThemeSwitcher.tsx
index 567db04cced..65e0136126e 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutCustomThemeSwitcher.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutCustomThemeSwitcher.tsx
@@ -15,7 +15,7 @@ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import SettingsIcon from '@mui/icons-material/Settings';
import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -143,19 +143,24 @@ export default function DashboardLayoutCustomThemeSwitcher(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
+
-
-
-
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutFullScreen.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutFullScreen.js
index 2205c2f6f0b..f757179ede1 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutFullScreen.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutFullScreen.js
@@ -4,7 +4,7 @@ import { createTheme } from '@mui/material/styles';
import MapIcon from '@mui/icons-material/Map';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -39,22 +39,27 @@ function DashboardLayoutFullScreen(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutFullScreen.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutFullScreen.tsx
index f526b2cda2c..fa976ee1881 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutFullScreen.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutFullScreen.tsx
@@ -3,7 +3,7 @@ import { createTheme } from '@mui/material/styles';
import MapIcon from '@mui/icons-material/Map';
import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -46,21 +46,26 @@ export default function DashboardLayoutFullScreen(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationActions.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationActions.js
index ecdfe76da68..28e52a22fde 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationActions.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationActions.js
@@ -14,7 +14,7 @@ import CallMadeIcon from '@mui/icons-material/CallMade';
import CallReceivedIcon from '@mui/icons-material/CallReceived';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -114,32 +114,35 @@ function DashboardLayoutNavigationActions(props) {
);
return (
- // preview-start
- ,
- action: ,
- },
- {
- segment: 'calls',
- title: 'Calls',
- icon: ,
- action: popoverMenuAction,
- children: CALLS_NAVIGATION,
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ action: ,
+ },
+ {
+ segment: 'calls',
+ title: 'Calls',
+ icon: ,
+ action: popoverMenuAction,
+ children: CALLS_NAVIGATION,
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationActions.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationActions.tsx
index 2431c0da069..c5df89bda12 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationActions.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationActions.tsx
@@ -13,7 +13,7 @@ import CallMadeIcon from '@mui/icons-material/CallMade';
import CallReceivedIcon from '@mui/icons-material/CallReceived';
import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -118,31 +118,34 @@ export default function DashboardLayoutNavigationActions(props: DemoProps) {
);
return (
- // preview-start
- ,
- action: ,
- },
- {
- segment: 'calls',
- title: 'Calls',
- icon: ,
- action: popoverMenuAction,
- children: CALLS_NAVIGATION,
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ action: ,
+ },
+ {
+ segment: 'calls',
+ title: 'Calls',
+ icon: ,
+ action: popoverMenuAction,
+ children: CALLS_NAVIGATION,
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationDividers.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationDividers.js
index 8ce503b3e41..203a4056a61 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationDividers.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationDividers.js
@@ -6,7 +6,7 @@ import { createTheme } from '@mui/material/styles';
import DescriptionIcon from '@mui/icons-material/Description';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -53,30 +53,33 @@ function DashboardLayoutNavigationDividers(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- },
- { kind: 'divider' },
- {
- segment: 'eagle',
- title: 'Eagle',
- icon: ,
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ },
+ { kind: 'divider' },
+ {
+ segment: 'eagle',
+ title: 'Eagle',
+ icon: ,
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationDividers.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationDividers.tsx
index a034bb281eb..f72f321c507 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationDividers.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationDividers.tsx
@@ -5,7 +5,7 @@ import { createTheme } from '@mui/material/styles';
import DescriptionIcon from '@mui/icons-material/Description';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -56,29 +56,32 @@ export default function DashboardLayoutNavigationDividers(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- },
- { kind: 'divider' },
- {
- segment: 'eagle',
- title: 'Eagle',
- icon: ,
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ },
+ { kind: 'divider' },
+ {
+ segment: 'eagle',
+ title: 'Eagle',
+ icon: ,
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationHeadings.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationHeadings.js
index 337ca3a1c89..a33276dc196 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationHeadings.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationHeadings.js
@@ -6,7 +6,7 @@ import { createTheme } from '@mui/material/styles';
import DescriptionIcon from '@mui/icons-material/Description';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -53,37 +53,40 @@ function DashboardLayoutNavigationHeadings(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- },
- {
- kind: 'header',
- title: 'Movies',
- },
- {
- segment: 'lord-of-the-rings',
- title: 'Lord of the Rings',
- icon: ,
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ },
+ {
+ kind: 'header',
+ title: 'Movies',
+ },
+ {
+ segment: 'lord-of-the-rings',
+ title: 'Lord of the Rings',
+ icon: ,
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationHeadings.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationHeadings.tsx
index d427ff779fb..065be034ab4 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationHeadings.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationHeadings.tsx
@@ -5,7 +5,7 @@ import { createTheme } from '@mui/material/styles';
import DescriptionIcon from '@mui/icons-material/Description';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -56,36 +56,39 @@ export default function DashboardLayoutNavigationHeadings(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- },
- {
- kind: 'header',
- title: 'Movies',
- },
- {
- segment: 'lord-of-the-rings',
- title: 'Lord of the Rings',
- icon: ,
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ },
+ {
+ kind: 'header',
+ title: 'Movies',
+ },
+ {
+ segment: 'lord-of-the-rings',
+ title: 'Lord of the Rings',
+ icon: ,
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationLinks.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationLinks.js
index e3417db76c9..ea5fd1da952 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationLinks.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationLinks.js
@@ -6,7 +6,7 @@ import { createTheme } from '@mui/material/styles';
import DescriptionIcon from '@mui/icons-material/Description';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -53,29 +53,32 @@ function DashboardLayoutNavigationLinks(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- },
- {
- segment: 'about',
- title: 'About Us',
- icon: ,
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ },
+ {
+ segment: 'about',
+ title: 'About Us',
+ icon: ,
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationLinks.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationLinks.tsx
index 4428dab4aec..698eb69d2fb 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationLinks.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationLinks.tsx
@@ -5,7 +5,7 @@ import { createTheme } from '@mui/material/styles';
import DescriptionIcon from '@mui/icons-material/Description';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -56,28 +56,31 @@ export default function DashboardLayoutNavigationLinks(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- },
- {
- segment: 'about',
- title: 'About Us',
- icon: ,
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ },
+ {
+ segment: 'about',
+ title: 'About Us',
+ icon: ,
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationNested.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationNested.js
index 62fef512955..d8a8365a34f 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationNested.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationNested.js
@@ -7,7 +7,7 @@ import DescriptionIcon from '@mui/icons-material/Description';
import FolderIcon from '@mui/icons-material/Folder';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -54,36 +54,39 @@ function DashboardLayoutNavigationNested(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- children: [
- {
- segment: 'lord-of-the-rings',
- title: 'Lord of the Rings',
- icon: ,
- },
- {
- segment: 'harry-potter',
- title: 'Harry Potter',
- icon: ,
- },
- ],
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ children: [
+ {
+ segment: 'lord-of-the-rings',
+ title: 'Lord of the Rings',
+ icon: ,
+ },
+ {
+ segment: 'harry-potter',
+ title: 'Harry Potter',
+ icon: ,
+ },
+ ],
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationNested.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationNested.tsx
index b818a230e8b..11c211c70c3 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationNested.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNavigationNested.tsx
@@ -6,7 +6,7 @@ import DescriptionIcon from '@mui/icons-material/Description';
import FolderIcon from '@mui/icons-material/Folder';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -57,35 +57,38 @@ export default function DashboardLayoutNavigationNested(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- children: [
- {
- segment: 'lord-of-the-rings',
- title: 'Lord of the Rings',
- icon: ,
- },
- {
- segment: 'harry-potter',
- title: 'Harry Potter',
- icon: ,
- },
- ],
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ children: [
+ {
+ segment: 'lord-of-the-rings',
+ title: 'Lord of the Rings',
+ icon: ,
+ },
+ {
+ segment: 'harry-potter',
+ title: 'Harry Potter',
+ icon: ,
+ },
+ ],
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNoMiniSidebar.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNoMiniSidebar.js
index 8018cb8092a..4345f39620d 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNoMiniSidebar.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNoMiniSidebar.js
@@ -8,7 +8,7 @@ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import BarChartIcon from '@mui/icons-material/BarChart';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -73,16 +73,21 @@ function DashboardLayoutNoMiniSidebar(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNoMiniSidebar.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNoMiniSidebar.tsx
index c9b65ffa7e2..8589f7cc95a 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNoMiniSidebar.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutNoMiniSidebar.tsx
@@ -7,7 +7,7 @@ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import BarChartIcon from '@mui/icons-material/BarChart';
import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -76,15 +76,20 @@ export default function DashboardLayoutNoMiniSidebar(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutPattern.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutPattern.js
index cee334b8a9d..9a94b9b5129 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutPattern.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutPattern.js
@@ -9,7 +9,7 @@ import DashboardIcon from '@mui/icons-material/Dashboard';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -82,30 +82,33 @@ function DashboardLayoutPattern(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- },
- {
- segment: 'orders',
- title: 'Orders',
- icon: ,
- pattern: 'orders{/:orderId}*',
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ },
+ {
+ segment: 'orders',
+ title: 'Orders',
+ icon: ,
+ pattern: 'orders{/:orderId}*',
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutPattern.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutPattern.tsx
index a8c0adb29b6..e922e7b2fbb 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutPattern.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutPattern.tsx
@@ -8,7 +8,7 @@ import DashboardIcon from '@mui/icons-material/Dashboard';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -90,29 +90,32 @@ export default function DashboardLayoutPattern(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
- // preview-start
- ,
- },
- {
- segment: 'orders',
- title: 'Orders',
- icon: ,
- pattern: 'orders{/:orderId}*',
- },
- ]}
- router={router}
- theme={demoTheme}
- window={demoWindow}
- >
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+ ,
+ },
+ {
+ segment: 'orders',
+ title: 'Orders',
+ icon: ,
+ pattern: 'orders{/:orderId}*',
+ },
+ ]}
+ router={router}
+ theme={demoTheme}
+ window={demoWindow}
+ >
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarCollapsed.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarCollapsed.js
index ba077fd5553..6fbac857dc8 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarCollapsed.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarCollapsed.js
@@ -8,6 +8,7 @@ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import BarChartIcon from '@mui/icons-material/BarChart';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
+import { DemoProvider } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -80,16 +81,21 @@ function DashboardLayoutSidebarCollapsed(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarCollapsed.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarCollapsed.tsx
index 2877b54cd4f..f053b3654ac 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarCollapsed.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarCollapsed.tsx
@@ -11,6 +11,7 @@ import {
type Navigation,
} from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
+import { DemoProvider } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -87,15 +88,20 @@ export default function DashboardLayoutSidebarCollapsed(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarHidden.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarHidden.js
index 8fb42b4408e..98243e77513 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarHidden.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarHidden.js
@@ -5,7 +5,7 @@ import Typography from '@mui/material/Typography';
import { createTheme } from '@mui/material/styles';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -52,11 +52,16 @@ function DashboardLayoutSidebarHidden(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarHidden.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarHidden.tsx
index 9b2bb58c4a7..5d3b2581b14 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarHidden.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSidebarHidden.tsx
@@ -4,7 +4,7 @@ import Typography from '@mui/material/Typography';
import { createTheme } from '@mui/material/styles';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const demoTheme = createTheme({
cssVariables: {
@@ -55,10 +55,15 @@ export default function DashboardLayoutSidebarHidden(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSlots.js b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSlots.js
index d816fa3451e..cc71dc1308b 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSlots.js
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSlots.js
@@ -15,7 +15,7 @@ import CheckCircleIcon from '@mui/icons-material/CheckCircle';
import SearchIcon from '@mui/icons-material/Search';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout, ThemeSwitcher } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -144,22 +144,27 @@ function DashboardLayoutSlots(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
+
-
-
-
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSlots.tsx b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSlots.tsx
index 0864e54c197..ad0789f864e 100644
--- a/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSlots.tsx
+++ b/docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutSlots.tsx
@@ -18,7 +18,7 @@ import {
ThemeSwitcher,
type SidebarFooterProps,
} from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -147,21 +147,26 @@ export default function DashboardLayoutSlots(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
+
-
-
-
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.js b/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.js
index 43d867e76ce..50a238ae1d3 100644
--- a/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.js
+++ b/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.js
@@ -5,7 +5,7 @@ import MapIcon from '@mui/icons-material/Map';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -40,24 +40,27 @@ function PageContainerFullScreen(props) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.tsx b/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.tsx
index 4b3ff0fdb3c..9b872e1f6ec 100644
--- a/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.tsx
+++ b/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.tsx
@@ -4,7 +4,7 @@ import MapIcon from '@mui/icons-material/Map';
import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -47,23 +47,26 @@ export default function PageContainerFullScreen(props: DemoProps) {
const demoWindow = window !== undefined ? window() : undefined;
return (
-
-
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.tsx.preview b/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.tsx.preview
deleted file mode 100644
index 973c30fdb99..00000000000
--- a/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.tsx.preview
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/data/toolpad/core/integrations/ReactRouter.js b/docs/data/toolpad/core/integrations/ReactRouter.js
index 8498907f251..4352895c43f 100644
--- a/docs/data/toolpad/core/integrations/ReactRouter.js
+++ b/docs/data/toolpad/core/integrations/ReactRouter.js
@@ -8,6 +8,7 @@ import { createMemoryRouter, RouterProvider, Outlet } from 'react-router';
import { ReactRouterAppProvider } from '@toolpad/core/react-router';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
+import { DemoProvider } from '@toolpad/core/internal';
function Layout() {
return (
@@ -67,14 +68,17 @@ function App(props) {
const { window } = props;
return (
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/integrations/ReactRouter.tsx b/docs/data/toolpad/core/integrations/ReactRouter.tsx
index e84f94173e4..46a02f74692 100644
--- a/docs/data/toolpad/core/integrations/ReactRouter.tsx
+++ b/docs/data/toolpad/core/integrations/ReactRouter.tsx
@@ -7,6 +7,7 @@ import { createMemoryRouter, RouterProvider, Outlet } from 'react-router';
import { ReactRouterAppProvider } from '@toolpad/core/react-router';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
+import { DemoProvider } from '@toolpad/core/internal';
import type { Navigation } from '@toolpad/core/AppProvider';
function Layout() {
@@ -67,14 +68,17 @@ function App(props: { window?: Window }) {
const { window } = props;
return (
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+
+
+
);
}
diff --git a/docs/data/toolpad/core/introduction/Introduction.js b/docs/data/toolpad/core/introduction/Introduction.js
index 4ed73322c3f..d212663c398 100644
--- a/docs/data/toolpad/core/introduction/Introduction.js
+++ b/docs/data/toolpad/core/introduction/Introduction.js
@@ -9,7 +9,7 @@ import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { Crud, DataSourceCache } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -286,20 +286,23 @@ function Introduction(props) {
}, [router.pathname]);
return (
- // preview-start
-
-
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/introduction/Introduction.tsx b/docs/data/toolpad/core/introduction/Introduction.tsx
index 611e6327567..4fea4d6d34a 100644
--- a/docs/data/toolpad/core/introduction/Introduction.tsx
+++ b/docs/data/toolpad/core/introduction/Introduction.tsx
@@ -8,7 +8,7 @@ import { AppProvider, type Navigation } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import { Crud, DataModel, DataSource, DataSourceCache } from '@toolpad/core/Crud';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION: Navigation = [
{
@@ -296,19 +296,22 @@ export default function Introduction(props: DemoProps) {
}, [router.pathname]);
return (
- // preview-start
-
-
-
-
-
-
-
- // preview-end
+ // Remove this provider when copying and pasting into your project.
+
+ {/* preview-start */}
+
+
+
+
+
+
+
+ {/* preview-end */}
+
);
}
diff --git a/docs/data/toolpad/core/introduction/TutorialDefault.js b/docs/data/toolpad/core/introduction/TutorialDefault.js
index 355c955e6ff..dfbc114fcff 100644
--- a/docs/data/toolpad/core/introduction/TutorialDefault.js
+++ b/docs/data/toolpad/core/introduction/TutorialDefault.js
@@ -6,7 +6,7 @@ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
const NAVIGATION = [
{
@@ -61,16 +61,21 @@ function TutorialDefault(props) {
const demoRouter = useDemoRouter('/page');
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/introduction/TutorialDefault.tsx b/docs/data/toolpad/core/introduction/TutorialDefault.tsx
index ee9ce386b87..6a654e39d84 100644
--- a/docs/data/toolpad/core/introduction/TutorialDefault.tsx
+++ b/docs/data/toolpad/core/introduction/TutorialDefault.tsx
@@ -5,7 +5,7 @@ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
import type { Navigation } from '@toolpad/core/AppProvider';
const NAVIGATION: Navigation = [
@@ -65,15 +65,20 @@ export default function TutorialDefault(props: DemoProps) {
const demoRouter = useDemoRouter('/page');
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/introduction/TutorialPages.js b/docs/data/toolpad/core/introduction/TutorialPages.js
index 1388f38a053..75bc08503b2 100644
--- a/docs/data/toolpad/core/introduction/TutorialPages.js
+++ b/docs/data/toolpad/core/introduction/TutorialPages.js
@@ -7,7 +7,7 @@ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import TimelineIcon from '@mui/icons-material/Timeline';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
import { PageContainer } from '@toolpad/core/PageContainer';
const NAVIGATION = [
@@ -80,16 +80,21 @@ function TutorialPages(props) {
const demoRouter = useDemoRouter('/page-2');
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/data/toolpad/core/introduction/TutorialPages.tsx b/docs/data/toolpad/core/introduction/TutorialPages.tsx
index fb24c7d6a95..580aae29cbf 100644
--- a/docs/data/toolpad/core/introduction/TutorialPages.tsx
+++ b/docs/data/toolpad/core/introduction/TutorialPages.tsx
@@ -6,7 +6,7 @@ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import TimelineIcon from '@mui/icons-material/Timeline';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
-import { useDemoRouter } from '@toolpad/core/internal';
+import { DemoProvider, useDemoRouter } from '@toolpad/core/internal';
import { PageContainer } from '@toolpad/core/PageContainer';
import type { Navigation } from '@toolpad/core/AppProvider';
@@ -83,15 +83,20 @@ export default function TutorialPages(props: DemoProps) {
const demoRouter = useDemoRouter('/page-2');
return (
-
-
-
-
-
+ // Remove this provider when copying and pasting into your project.
+
+
+ {/* preview-start */}
+
+
+
+ {/* preview-end */}
+
+
);
}
diff --git a/docs/pages/toolpad/core/react-sign-in-page/index.js b/docs/pages/toolpad/core/react-sign-in-page/index.js
index 8c196df45e9..12dd8f2a6b5 100644
--- a/docs/pages/toolpad/core/react-sign-in-page/index.js
+++ b/docs/pages/toolpad/core/react-sign-in-page/index.js
@@ -1,12 +1,7 @@
import * as React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
-import { DocsContext } from '@toolpad/core/internal';
import * as pageProps from '../../../../data/toolpad/core/components/sign-in-page/sign-in-page.md?muiMarkdown';
export default function Page() {
- return (
-
-
-
- );
+ return ;
}
diff --git a/docs/scripts/formattedTSDemos.js b/docs/scripts/formattedTSDemos.js
index 6979f3a8cfe..0d310a3b78e 100644
--- a/docs/scripts/formattedTSDemos.js
+++ b/docs/scripts/formattedTSDemos.js
@@ -92,7 +92,7 @@ async function transpileFile(tsxPath, project) {
{
maxLines: 16,
outputFilename: `${tsxPath}.preview`,
- wrapperTypes: ['div', 'Box', 'Stack', 'AppProvider'],
+ wrapperTypes: ['div', 'Box', 'Stack', 'AppProvider', 'DemoProvider'],
},
],
]);
diff --git a/packages/toolpad-core/package.json b/packages/toolpad-core/package.json
index ae8d6719123..cdf0923c85a 100644
--- a/packages/toolpad-core/package.json
+++ b/packages/toolpad-core/package.json
@@ -55,6 +55,8 @@
"prop-types": "15.8.1"
},
"devDependencies": {
+ "@emotion/cache": "11.14.0",
+ "@emotion/react": "11.14.0",
"@mui/icons-material": "^7.0.2",
"@mui/material": "^7.0.2",
"@mui/x-data-grid-premium": "^8.0.0 || ^8.0.0-beta",
@@ -73,6 +75,8 @@
"vitest": "2.1.9"
},
"peerDependencies": {
+ "@emotion/cache": "^11",
+ "@emotion/react": "^11",
"@mui/icons-material": "^7.0.0-beta || ^7.0.0",
"@mui/material": "^7.0.0-beta || ^7.0.0",
"next": "^14 || ^15",
diff --git a/packages/toolpad-core/src/AppProvider/AppProvider.tsx b/packages/toolpad-core/src/AppProvider/AppProvider.tsx
index e4c167707d0..f3dd9c9fe2c 100644
--- a/packages/toolpad-core/src/AppProvider/AppProvider.tsx
+++ b/packages/toolpad-core/src/AppProvider/AppProvider.tsx
@@ -11,7 +11,7 @@ import {
WindowContext,
} from '../shared/context';
import type { LinkProps } from '../shared/Link';
-import { AppThemeProvider } from './AppThemeProvider';
+import { AppThemeProvider, COLOR_SCHEME_ATTRIBUTE } from './AppThemeProvider';
import { LocalizationProvider, type LocaleText } from './LocalizationProvider';
export interface NavigateOptions {
@@ -131,7 +131,7 @@ export interface AppProviderProps {
function createTheme(): Theme {
return createMuiTheme({
cssVariables: {
- colorSchemeSelector: 'data-toolpad-color-scheme',
+ colorSchemeSelector: COLOR_SCHEME_ATTRIBUTE,
},
colorSchemes: { dark: true },
});
diff --git a/packages/toolpad-core/src/AppProvider/AppThemeProvider.tsx b/packages/toolpad-core/src/AppProvider/AppThemeProvider.tsx
index 444fcb889d1..d072e5d65ef 100644
--- a/packages/toolpad-core/src/AppProvider/AppThemeProvider.tsx
+++ b/packages/toolpad-core/src/AppProvider/AppThemeProvider.tsx
@@ -8,9 +8,9 @@ import { useLocalStorageState } from '../useLocalStorageState';
import { PaletteModeContext } from '../shared/context';
import type { AppTheme } from './AppProvider';
-const COLOR_SCHEME_ATTRIBUTE = 'data-toolpad-color-scheme';
-const COLOR_SCHEME_STORAGE_KEY = 'toolpad-color-scheme';
-const MODE_STORAGE_KEY = 'toolpad-mode';
+export const COLOR_SCHEME_ATTRIBUTE = 'data-toolpad-color-scheme';
+export const COLOR_SCHEME_STORAGE_KEY = 'toolpad-color-scheme';
+export const MODE_STORAGE_KEY = 'toolpad-mode';
function usePreferredMode(window?: Window) {
const prefersDarkMode = useMediaQuery(
diff --git a/packages/toolpad-core/src/internal/context.ts b/packages/toolpad-core/src/internal/context.ts
deleted file mode 100644
index f3edbe55743..00000000000
--- a/packages/toolpad-core/src/internal/context.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-'use client';
-import * as React from 'react';
-
-export const DocsContext = React.createContext(false);
diff --git a/packages/toolpad-core/src/internal/demo.tsx b/packages/toolpad-core/src/internal/demo.tsx
index 04e542cb3e0..9154f6ebc52 100644
--- a/packages/toolpad-core/src/internal/demo.tsx
+++ b/packages/toolpad-core/src/internal/demo.tsx
@@ -1,5 +1,7 @@
'use client';
import * as React from 'react';
+import createCache from '@emotion/cache';
+import { CacheProvider } from '@emotion/react';
import { Router } from '../AppProvider';
/**
@@ -7,6 +9,45 @@ import { Router } from '../AppProvider';
* @ignore - internal component.
*/
+function useExternalProductionWarning({ featureName }: { featureName: string }) {
+ const isExternalProduction =
+ typeof window !== 'undefined' &&
+ window.location.hostname !== 'mui.com' &&
+ process.env.NODE_ENV === 'production';
+
+ React.useEffect(() => {
+ if (isExternalProduction) {
+ console.warn(
+ `${featureName} is an internal feature of Toolpad Core. This feature is not meant for general usage in production.`,
+ );
+ }
+ }, [featureName, isExternalProduction]);
+}
+
+interface DemoProviderProps {
+ /**
+ * The window where the application is rendered.
+ * @default window
+ */
+ window?: Window;
+ children: React.ReactNode;
+}
+// Wrapper for demo applications in the documentation
+export function DemoProvider({ window, children }: DemoProviderProps) {
+ useExternalProductionWarning({ featureName: 'DemoProvider' });
+
+ const demoEmotionCache = React.useMemo(
+ () =>
+ createCache({
+ key: 'toolpad-demo-app',
+ container: window?.document.head,
+ }),
+ [window?.document.head],
+ );
+
+ return {children};
+}
+
const DUMMY_BASE = 'https://example.com';
/**
@@ -14,6 +55,8 @@ const DUMMY_BASE = 'https://example.com';
* @returns An in-memory router To be used in demos demos.
*/
export function useDemoRouter(initialUrl: string = '/') {
+ useExternalProductionWarning({ featureName: 'useDemoRouter' });
+
const [url, setUrl] = React.useState(() => new URL(initialUrl, DUMMY_BASE));
const router = React.useMemo(() => {
diff --git a/packages/toolpad-core/src/internal/index.tsx b/packages/toolpad-core/src/internal/index.tsx
index e3391b5e1a2..2ff87712938 100644
--- a/packages/toolpad-core/src/internal/index.tsx
+++ b/packages/toolpad-core/src/internal/index.tsx
@@ -1,4 +1,3 @@
export { Link } from '../shared/Link';
export * from './demo';
-export { DocsContext } from './context';
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 83b2ceaaae8..670a7c7a87e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -650,6 +650,12 @@ importers:
specifier: ^18 || ^19
version: 19.1.0
devDependencies:
+ '@emotion/cache':
+ specifier: 11.14.0
+ version: 11.14.0
+ '@emotion/react':
+ specifier: 11.14.0
+ version: 11.14.0(@types/react@19.1.2)(react@19.1.0)
'@mui/icons-material':
specifier: ^7.0.2
version: 7.0.2(@mui/material@7.0.2(@emotion/react@11.14.0(@types/react@19.1.2)(react@19.1.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.1.2)(react@19.1.0))(@types/react@19.1.2)(react@19.1.0))(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(@types/react@19.1.2)(react@19.1.0)