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
40 lines
939 B
TypeScript
40 lines
939 B
TypeScript
import * as React from 'react';
|
|
import Button from '@mui/material/Button';
|
|
import Snackbar, { SnackbarCloseReason } from '@mui/material/Snackbar';
|
|
import Alert from '@mui/material/Alert';
|
|
|
|
export default function CustomizedSnackbars() {
|
|
const [open, setOpen] = React.useState(false);
|
|
|
|
const handleClick = () => {
|
|
setOpen(true);
|
|
};
|
|
|
|
const handleClose = (
|
|
event?: React.SyntheticEvent | Event,
|
|
reason?: SnackbarCloseReason,
|
|
) => {
|
|
if (reason === 'clickaway') {
|
|
return;
|
|
}
|
|
|
|
setOpen(false);
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<Button onClick={handleClick}>Open Snackbar</Button>
|
|
<Snackbar open={open} autoHideDuration={6000} onClose={handleClose}>
|
|
<Alert
|
|
onClose={handleClose}
|
|
severity="success"
|
|
variant="filled"
|
|
sx={{ width: '100%' }}
|
|
>
|
|
This is a success Alert inside a Snackbar!
|
|
</Alert>
|
|
</Snackbar>
|
|
</div>
|
|
);
|
|
}
|