Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
import * as React from 'react';
|
|
import Popover from '@mui/material/Popover';
|
|
import Typography from '@mui/material/Typography';
|
|
|
|
export default function MouseHoverPopover() {
|
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
|
|
const handlePopoverOpen = (event) => {
|
|
setAnchorEl(event.currentTarget);
|
|
};
|
|
|
|
const handlePopoverClose = () => {
|
|
setAnchorEl(null);
|
|
};
|
|
|
|
const open = Boolean(anchorEl);
|
|
|
|
return (
|
|
<div>
|
|
<Typography
|
|
aria-owns={open ? 'mouse-over-popover' : undefined}
|
|
aria-haspopup="true"
|
|
onMouseEnter={handlePopoverOpen}
|
|
onMouseLeave={handlePopoverClose}
|
|
>
|
|
Hover with a Popover.
|
|
</Typography>
|
|
<Popover
|
|
id="mouse-over-popover"
|
|
sx={{ pointerEvents: 'none' }}
|
|
open={open}
|
|
anchorEl={anchorEl}
|
|
anchorOrigin={{
|
|
vertical: 'bottom',
|
|
horizontal: 'left',
|
|
}}
|
|
transformOrigin={{
|
|
vertical: 'top',
|
|
horizontal: 'left',
|
|
}}
|
|
onClose={handlePopoverClose}
|
|
disableRestoreFocus
|
|
>
|
|
<Typography sx={{ p: 1 }}>I use Popover.</Typography>
|
|
</Popover>
|
|
</div>
|
|
);
|
|
}
|