/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/data/material/components/dialogs/AlertDialog.tsx
50 строк
1 KB
Silviu Alexandru Avram
[alert][dialog] Accessibility improvements (#48113)
31 мар 2026, 13:22
Не верифицирован
31 мар 2026, 13:22
e65f91f
Код
Авторство
О чём код?
import * as React from 'react'; import Button from '@mui/material/Button'; import Dialog from '@mui/material/Dialog'; import DialogActions from '@mui/material/DialogActions'; import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogTitle from '@mui/material/DialogTitle'; export default function AlertDialog() { const [open, setOpen] = React.useState(false); const handleClickOpen = () => { setOpen(true); }; const handleClose = () => { setOpen(false); }; return ( <React.Fragment> <Button variant="outlined" onClick={handleClickOpen}> Open alert dialog </Button> <Dialog open={open} onClose={handleClose} aria-labelledby="alert-dialog-title" aria-describedby="alert-dialog-description" role="alertdialog" > <DialogTitle id="alert-dialog-title"> {"Use Google's location service?"} </DialogTitle> <DialogContent> <DialogContentText id="alert-dialog-description"> Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running. </DialogContentText> </DialogContent> <DialogActions> <Button onClick={handleClose} autoFocus> Disagree </Button> <Button onClick={handleClose}>Agree</Button> </DialogActions> </Dialog> </React.Fragment> ); }