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/HorizontalMenu.md
+91-56Lines changed: 91 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,17 @@ title: "HorizontalMenu"
5
5
6
6
# `<HorizontalMenu>`
7
7
8
-
A horizontal menu component, alternative to react-admin's `<Menu>`, to be used in the AppBar of the `<ContainerLayout>`.
8
+
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<imgclass="icon"src="./img/premium.svg" /> renders a horizontal menu component, alternative to react-admin's `<Menu>`, to be used in the AppBar of the [`<ContainerLayout>`](./ContainerLayout.md).
9
9
10
10

11
11
12
+
`<HorizontalMenu>` is part of the [ra-navigation](https://react-admin-ee.marmelab.com/documentation/ra-navigation#containerlayout) package.
13
+
12
14
## Usage
13
15
14
-
Create a menu component based on `<HorizontalMenu>` and `<HorizontalMenu.Item>` (or `<HorizontalMenu.DashboardItem>`) children. Each child should have a `value` corresponding to the [application location](https://react-admin-ee.marmelab.com/documentation/ra-navigation#concepts) of the target, and can have a `to` prop corresponding to the target location if different from the app location.
16
+
Create a menu component based on `<HorizontalMenu>` and `<HorizontalMenu.Item>` (or `<HorizontalMenu.DashboardItem>`) children.
17
+
18
+
Each child should have a `value` corresponding to the [application location](https://react-admin-ee.marmelab.com/documentation/ra-navigation#concepts) of the target, and can have a `to` prop corresponding to the target location if different from the app location.
|`children`| Optional ||| The menu items to display. |
53
65
|`hasDashboard`| Optional | Boolean || Display an `<HorizontalMenu.DashboardItem>` with your resources if no children specified |
54
66
55
67
It also accept the props of [MUI Tabs](https://mui.com/material-ui/api/tabs/#props).
56
68
69
+
## `children`
70
+
71
+
When you use `<HorizontalMenu>` without any child, it automatically adds one menu item per resource.
72
+
73
+
If you want to customize the menu items, pass them as children to the `<HorizontalMenu>`. Each child should be a [`<HorizontalMenu.Item>`](#horizontalmenuitem) or a [`<HorizontalMenu.DashboardItem>`](#horizontalmenudashboarditem).
When you're using `<HorizontalMenu>` without any child, it detects your resources and adds dedicated `<HorizontalMenu.Item>` components for you. You can specify that you want a `<HorizontalMenu.DashboardItem>` with it thanks to the `hasDashboard` prop.
94
+
This prop lets you add a dashboard item when using `<HorizontalMenu>` with no children.
An item for the `<HorizontalMenu>` component. Used to define access to a resource or a custom route.
108
+
An item for the `<HorizontalMenu>` component. Used to define access to a list view for a resource, or a custom route.
74
109
75
110
```tsx
76
111
<HorizontalMenu>
@@ -92,41 +127,62 @@ An item for the `<HorizontalMenu>` component. Used to define access to a resourc
92
127
|`MenuProps`| Optional |[MenuProps](https://mui.com/material-ui/api/menu/#props)|| Additional props of the Menu (`HorizontalMenu.Item` with children) |
93
128
|`MenuItemProps`| Optional |[MenuItemProps](https://mui.com/material-ui/api/menu-item/#props)|| Additional props of the MenuItem (children of a `HorizontalMenu.Item`) |
94
129
95
-
### `value`
130
+
### `label`
96
131
97
-
The `value` passed to the [MUI `Tab`](https://mui.com/material-ui/react-tabs/):
132
+
You can customize the label by setting the `label` prop. It is inferred from the `value` prop by default.
133
+
134
+
`<HorizontalMenu.Item>` uses the i18n layer, so you can translate the label. Check [the Translation chapter](./TranslationTranslating.md) for more information.
You can customize the label by setting the `label` prop. It is inferred from the `value` prop by default.
145
+
Additional props passed to the [Menu](https://mui.com/material-ui/api/menu/#props) (item displayed if it has children).
109
146
110
-
`<HorizontalMenu.Item>` uses the i18n layer, so you can translate the label. Check [the Translation chapter](./TranslationTranslating.md) for more information.
0 commit comments