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
28 lines
784 B
TypeScript
28 lines
784 B
TypeScript
import * as React from 'react';
|
|
import Box from '@mui/material/Box';
|
|
import Popper from '@mui/material/Popper';
|
|
|
|
export default function SimplePopper() {
|
|
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
|
|
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
};
|
|
|
|
const open = Boolean(anchorEl);
|
|
const id = open ? 'simple-popper' : undefined;
|
|
|
|
return (
|
|
<div>
|
|
<button aria-describedby={id} type="button" onClick={handleClick}>
|
|
Toggle Popper
|
|
</button>
|
|
<Popper id={id} open={open} anchorEl={anchorEl}>
|
|
<Box sx={{ border: 1, p: 1, bgcolor: 'background.paper' }}>
|
|
The content of the Popper.
|
|
</Box>
|
|
</Popper>
|
|
</div>
|
|
);
|
|
}
|