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
|`to`| Required | `string | location` | - | The menu item's target. It is passed to a React Router [NavLink](https://reacttraining.com/react-router/web/api/NavLink) component. |
189
-
|`primaryText`| Required |`ReactNode`| - | The menu content, displayed when the menu isn't minimized. |
190
-
|`keyboardShortcut`| Optional | `string | string[]` | - | The keyboard shortcut(s) to activate this menu item |
191
-
|`leftIcon`| Optional |`ReactNode`| - | The menu icon |
192
-
|`sx`| Optional |`SxProp`| - | Style overrides, powered by MUI System |
|`to`| Required | `string | location` | - | The menu item's target. It is passed to a React Router [NavLink](https://reacttraining.com/react-router/web/api/NavLink) component. |
189
+
|`primaryText`| Required |`ReactNode`| - | The menu content, displayed when the menu isn't minimized. |
190
+
|`keyboardShortcut`| Optional | `string | string[]` | - | The keyboard shortcut(s) to activate this menu item |
191
+
|`keyboardShortcutRepresentation`| Optional |`ReactNode`|`<keyboardShortcut>`| A react node that displays the keyboard shortcut |
192
+
|`leftIcon`| Optional |`ReactNode`| - | The menu icon |
193
+
|`sx`| Optional |`SxProp`| - | Style overrides, powered by MUI System |
193
194
194
195
Additional props are passed down to [the underling Material UI `<MenuItem>` component](https://mui.com/material-ui/api/menu-item/).
This leverages the [react-hotkeys-hook](https://github.com/JohannesKlauss/react-hotkeys-hook) library, checkout [their documentation](https://react-hotkeys-hook.vercel.app/docs/documentation/useHotkeys/) for more examples.
250
252
253
+
### `keyboardShortcutRepresentation`
254
+
255
+
A React node that displays the keyboard shortcut. It defaults to `<KeyboardShortcut>`. You can customize it by providing your own:
256
+
257
+
```tsx
258
+
const CustomMenu = () => (
259
+
<Menu>
260
+
<Menu.Item
261
+
to="/sales"
262
+
primaryText="Sales"
263
+
keyboardShortcut="G>S"
264
+
// Render a simple textual representation of the shortcut
265
+
keyboardShortcutRepresentation="G then S"
266
+
/>
267
+
</Menu>
268
+
);
269
+
```
270
+
271
+
251
272
### `leftIcon`
252
273
253
274
The `letfIcon` prop allows setting the menu left icon.
0 commit comments