45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
|
|
import * as React from 'react';
|
||
|
|
import Button from '@mui/material/Button';
|
||
|
|
import Menu from '@mui/material/Menu';
|
||
|
|
import MenuItem from '@mui/material/MenuItem';
|
||
|
|
|
||
|
|
export default function BasicMenu() {
|
||
|
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
||
|
|
const open = Boolean(anchorEl);
|
||
|
|
const handleClick = (event) => {
|
||
|
|
setAnchorEl(event.currentTarget);
|
||
|
|
};
|
||
|
|
const handleClose = () => {
|
||
|
|
setAnchorEl(null);
|
||
|
|
};
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div>
|
||
|
|
<Button
|
||
|
|
id="basic-button"
|
||
|
|
aria-controls={open ? 'basic-menu' : undefined}
|
||
|
|
aria-haspopup="true"
|
||
|
|
aria-expanded={open ? 'true' : undefined}
|
||
|
|
onClick={handleClick}
|
||
|
|
>
|
||
|
|
Dashboard
|
||
|
|
</Button>
|
||
|
|
<Menu
|
||
|
|
id="basic-menu"
|
||
|
|
anchorEl={anchorEl}
|
||
|
|
open={open}
|
||
|
|
onClose={handleClose}
|
||
|
|
slotProps={{
|
||
|
|
list: {
|
||
|
|
'aria-labelledby': 'basic-button',
|
||
|
|
},
|
||
|
|
}}
|
||
|
|
>
|
||
|
|
<MenuItem onClick={handleClose}>Profile</MenuItem>
|
||
|
|
<MenuItem onClick={handleClose}>My account</MenuItem>
|
||
|
|
<MenuItem onClick={handleClose}>Logout</MenuItem>
|
||
|
|
</Menu>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|