Search code examples
react-admin

How to hide the profile menu on the app bar without using a custom layout?


I need to put the logout button instead the profile menu on the app bar.

I'm taking about this:

enter image description here

I was looking in the react-admin documentation but i didn't found something clear without use a custom layout with a custom appbar.


Solution

  • This is documented in the theming section of the react-admin documentation:

    import { AppBar, UserMenu, MenuItemLink } from 'react-admin';
    import SettingsIcon from '@material-ui/icons/Settings';
    
    const MyUserMenu = props => (
        <UserMenu {...props}>
            <MenuItemLink
                to="/configuration"
                primaryText="Configuration"
                leftIcon={<SettingsIcon />}
            />
        </UserMenu>
    );
    
    const MyAppBar = props => <AppBar {...props} userMenu={<MyUserMenu />} />;
    
    const MyLayout = props => <Layout {...props} appBar={MyAppBar} />;