UNPKG

react-garden

Version:

React + TypeScript + ThreeJS app using Material UI on NextJS, Apollo Client, GraphQL + WordPress REST APIs, for ThreeD web development.. a part of the threed.ai code family.

39 lines (32 loc) 906 B
// ** React Imports import { Fragment, useState } from 'react' // ** MUI Imports import Alert from '@mui/material/Alert' import Button from '@mui/material/Button' import Snackbar from '@mui/material/Snackbar' const SnackbarAlert = () => { // ** State const [open, setOpen] = useState(false) const handleClick = () => { setOpen(true) } const handleClose = (event, reason) => { if (reason === 'clickaway') { return } setOpen(false) } return ( <> <Button variant='outlined' onClick={handleClick}> Open alert snackbar </Button> <Snackbar open={open} onClose={handleClose} autoHideDuration={3000}> <Alert variant='filled' elevation={3} onClose={handleClose} severity='success'> This is a success message! </Alert> </Snackbar> </> ) } export default SnackbarAlert