<HorizontalMenu>
This Enterprise Edition component renders a horizontal menu, alternative to react-adminβs <Menu>
, to be used in the AppBar of the <ContainerLayout>
.
Usage
Create a menu component based on <HorizontalMenu>
and <HorizontalMenu.Item>
children. Each child should have a value
corresponding to the application location of the target, and can have a to
prop corresponding to the target location if different from the app location.
import { HorizontalMenu } from '@react-admin/ra-navigation';
export const Menu = () => (
<HorizontalMenu>
<HorizontalMenu.Item label="Dashboard" to="/" value="" />
<HorizontalMenu.Item label="Songs" to="/songs" value="songs" />
<HorizontalMenu.Item label="Artists" to="/artists" value="artists" />
</HorizontalMenu>
);
Then pass it to the <ContainerLayout>
:
import { Admin, Resource } from 'react-admin';
import { ContainerLayout } from '@react-admin/ra-navigation';
import { Menu } from './Menu';
const MyLayout = props => <ContainerLayout {...props} menu={<Menu />} />;
const App = () => (
<Admin dataProvider={dataProvider} layout={MyLayout}>
...
</Admin>
);
See more details in the ra-navigation documentation.