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
32 lines
666 B
JavaScript
32 lines
666 B
JavaScript
import * as React from 'react';
|
|
import Button from '@mui/material/Button';
|
|
import Snackbar from '@mui/material/Snackbar';
|
|
|
|
export default function AutohideSnackbar() {
|
|
const [open, setOpen] = React.useState(false);
|
|
|
|
const handleClick = () => {
|
|
setOpen(true);
|
|
};
|
|
|
|
const handleClose = (event, reason) => {
|
|
if (reason === 'clickaway') {
|
|
return;
|
|
}
|
|
|
|
setOpen(false);
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<Button onClick={handleClick}>Open Snackbar</Button>
|
|
<Snackbar
|
|
open={open}
|
|
autoHideDuration={5000}
|
|
onClose={handleClose}
|
|
message="This Snackbar will be dismissed in 5 seconds."
|
|
/>
|
|
</div>
|
|
);
|
|
}
|