<meta name="viewport" content="initial-scale=1, width=device-width" />
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<script src="https://unpkg.com/react@latest/umd/react.development.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/react-dom@latest/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@mui/material@latest/umd/material-ui.development.js"
crossorigin="anonymous"></script>
<script src="https://unpkg.com/@babel/standalone@latest/babel.min.js" crossorigin="anonymous"></script>
<script type="text/babel">
const [isButtonDisabled, setIsButtonDisabled] = React.useState(false);
const handleClick = () => {
setIsButtonDisabled(true); // Disable the button
// You can add any other logic or actions you want here
// Simulate a delay, you can replace this with your actual logic
setIsButtonDisabled(false); // Enable the button after a delay
}, 5000); // 2000 milliseconds (2 seconds) delay in this example
<Container maxWidth="md" sx={{ boxShadow: 1, p: 2 }}>
<Typography variant="h4" component="h1" gutterBottom>
React Material UI Disable Button for 5 Seconds
disabled={isButtonDisabled}
{isButtonDisabled ? 'Processing...' : 'Click Me'}
<script type="text/babel">
const { colors, CssBaseline, ThemeProvider, Typography, Container, createTheme, Button, } = MaterialUI;
const theme = createTheme({
const root = ReactDOM.createRoot(document.getElementById('root'));
<ThemeProvider theme={theme}>