Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Shows a modal dialog that opens and closes using Material-UI.
import React, { useState } from 'react';
import { Button, Dialog, DialogTitle, DialogContent, DialogActions, Typography } from '@mui/material';
const ModalExample = () => {
const [open, setOpen] = useState(false);
return (
<>
<Button variant='contained' onClick={() => setOpen(true)}>Open Modal</Button>
<Dialog open={open} onClose={() => setOpen(false)}>
<DialogTitle>Modal Title</DialogTitle>
<DialogContent>
<Typography>This is a simple Material-UI modal dialog.</Typography>
</DialogContent>
<DialogActions>
<Button onClick={() => setOpen(false)}>Close</Button>
</DialogActions>
</Dialog>
</>
);
};
export default ModalExample;Material-UI (MUI) is a React-based front-end framework that implements Google's Material Design system with prebuilt, customizable components and styling solutions.
Origin & Creator
Created by Olivier Tassinari in 2014 as a React implementation of Material Design.
Industrial Note
MUI is widely used in React projects where Material Design consistency, prebuilt components, and developer productivity are prioritized.