ra-treemenu
ra-treemenu copied to clipboard
Add custom menu items
Quick way to add custom menu items without Resource.
Usage:
import * as UI from 'ra-ui-materialui';
import TreeMenu from '@bb-tech/ra-treemenu';
import Settings from '@material-ui/icons/Settings';
const CustomMenuItems = [
<UI.MenuItemLink
to="/settings"
primaryText="Settings"
leftIcon={<Settings />}
/>,
];
const CustomLayout = (props) => {
TreeMenu.defaultProps.customMenuItems = CustomMenuItems;
return <UI.Layout {...props} menu={TreeMenu} />;
};
const App = (props) => (
<Admin
layout={(props) => <CustomLayout {...props} />}
{...props}
>
{props.children}
</Admin>
);
Better way is to support custom menu items inside menu but I didn't investigate this option because
- there is RA v4 where CustomRoutes component exists
- I don't know how to update the code of the lib for this
@ak-bigbasket Take a look please
+1