Files
react-test/docs/data/joy/components/modal/BasicModal.js
how2ice 005cf56baf
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
init project
2025-12-12 14:26:25 +09:00

45 lines
1.4 KiB
JavaScript

import * as React from 'react';
import Button from '@mui/joy/Button';
import Modal from '@mui/joy/Modal';
import ModalClose from '@mui/joy/ModalClose';
import Typography from '@mui/joy/Typography';
import Sheet from '@mui/joy/Sheet';
export default function BasicModal() {
const [open, setOpen] = React.useState(false);
return (
<React.Fragment>
<Button variant="outlined" color="neutral" onClick={() => setOpen(true)}>
Open modal
</Button>
<Modal
aria-labelledby="modal-title"
aria-describedby="modal-desc"
open={open}
onClose={() => setOpen(false)}
sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}
>
<Sheet
variant="outlined"
sx={{ maxWidth: 500, borderRadius: 'md', p: 3, boxShadow: 'lg' }}
>
<ModalClose variant="plain" sx={{ m: 1 }} />
<Typography
component="h2"
id="modal-title"
level="h4"
textColor="inherit"
sx={{ fontWeight: 'lg', mb: 1 }}
>
This is the modal title
</Typography>
<Typography id="modal-desc" textColor="text.tertiary">
Make sure to use <code>aria-labelledby</code> on the modal dialog with an
optional <code>aria-describedby</code> attribute.
</Typography>
</Sheet>
</Modal>
</React.Fragment>
);
}