You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/Admin.md
+26-16
Original file line number
Diff line number
Diff line change
@@ -387,39 +387,49 @@ For more details on predefined themes and custom themes, refer to [the Theming c
387
387
388
388
If you want to deeply customize the app header, the menu, or the notifications, the best way is to provide a custom layout component. It must contain a `{children}` placeholder, where react-admin will render the resources.
389
389
390
-
Use the [default layout](https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/layout/Layout.tsx) as a starting point, and check [the Theming documentation](./Theming.md#using-a-custom-layout) for examples.
390
+
React-admin offers predefined layouts for you to use:
391
+
392
+
-[`<Layout>`](./Layout.md): The default layout. It renders a top app bar and the navigation menu in a side bar.
393
+
-[`<ContainerLayout>`](./ContainerLayout.md): A centered layout with horizontal navigation.
Your custom layout can simply extend [the default `<Layout>` component](./Layout.md) if you only want to override the appBar, the menu, or the error page. For instance:
406
+
These layouts can be customized by passing props to them. For instance, you can pass a custom `appBar` prop to `<Layout>` to override the default app bar:
For more details on custom layouts, check [the Theming documentation](./Theming.md#using-a-custom-layout).
430
+
Refer to each component documentation to understand the props it accepts.
431
+
432
+
Finally, you can also pass a custom component as the `layout` prop. It must contain a `{children}` placeholder, where react-admin will render the content. Use the [default `<Layout>`](https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/layout/Layout.tsx) as a starting point, and check [the Theming documentation](./Theming.md#using-a-custom-layout) for examples.
Copy file name to clipboardexpand all lines: docs/ContainerLayout.md
+86-21
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,46 @@ See more details in the [ra-navigation documentation](https://marmelab.com/ra-en
29
29
30
30
## Props
31
31
32
-
`<ContainerLayout>` accepts the following props:
32
+
`<ContainerLayout>` accepts the following props, all optional:
33
33
34
-
-`menu`: The menu component to use. Defaults to `<HorizontalMenu>`.
35
34
-`appBar`: The component to use to render the top AppBar. Defaults to `<Header>`
36
-
-`toolbar`: The buttons to render on the top right of the toolbar.
37
-
-`maxWidth`: The maximum width of the content `<Container>`. Defaults to `md`.
38
35
-`fixed`: Whether the content `<Container>` should be fixed. Defaults to false.
36
+
-`maxWidth`: The maximum width of the content `<Container>`. Defaults to `md`.
37
+
-`menu`: The menu component to use. Defaults to `<HorizontalMenu>`.
38
+
-`sx`: The style of the layout, and the underlying component.
39
+
-`toolbar`: The buttons to render on the top right of the toolbar.
40
+
-`userMenu`: The component to use to render the user menu. Defaults to `<UserMenu>`.
41
+
42
+
## `appBar`
43
+
44
+
If you want to use a different color for the AppBar, or to make it sticky, pass a custom `appBar` element based on `<Header>`, which is a simple wrapper around [MUI's `<AppBar>` component](https://mui.com/material-ui/react-app-bar/#main-content).
If you prefer to design for a fixed set of sizes instead of trying to accommodate a fully fluid viewport, you can set the `fixed` prop. The max-width matches the min-width of the current breakpoint.
This prop allows to set the maximum width of the content [`<Container>`](https://mui.com/material-ui/react-container/#main-content). It accepts a string, one of `xs`, `sm`, `md`, `lg`, `xl`, or `false` to remove side margins and occupy the full width of the screen.
If you want to use a different color for the AppBar, or to make it sticky, pass a custom `appBar` element based on `<Header>`, which is a simple wrapper around [MUI's `<AppBar>` component](https://mui.com/material-ui/react-app-bar/#main-content).
124
+
The `sx` prop allows to customize the style of the layout, and the underlying component. It accepts a [MUI`sx` prop](https://mui.com/system/the-sx-prop/#main-content).
This prop allows to set the maximum width of the content [`<Container>`](https://mui.com/material-ui/react-container/#main-content). It accepts a string, one of `xs`, `sm`, `md`, `lg`, `xl`, or `false` to remove side margins and occupy the full width of the screen.
160
+
By default, the `<ContainerLayout>` shows a user menu with a single item (logout) when the application has an `authProvider`. You can customize the user menu by passing a custom element to the `userMenu` prop.
If you prefer to design for a fixed set of sizes instead of trying to accommodate a fully fluid viewport, you can set the `fixed` prop. The max-width matches the min-width of the current breakpoint.
If you can't configure `<Layout>` to render the layout you want, you can use an alternative layout component, such as [`<ContainerLayout>`](./ContainerLayout.md): A centered layout with horizontal navigation.
0 commit comments