Skip to main content

Modal

The Modal component is a dialog box that overlays the main content and requires the user’s attention or interaction. The Modal component can have different parts, such as a title, a body, and a footer. The Modal component can also have different size and behaviors, such as closing when the user clicks in the close button.

You can find the Modals component in the src/views/Modals.jsx file.

Examples

Add dialogs to your site for lightboxes, user notifications, or completely custom content. Modal Preview

Result

Small
import { useState } from "react";
import { Button, Modal } from "react-bootstrap";

function SmallModal() {
const [show, setShow] = useState(false);

const handleClose = () => setShow(false);
const handleShow = () => setShow(true);

return (
<>
<Button variant="secondary" onClick={handleShow}>
Small
</Button>
<Modal show={show} onHide={handleClose} backdrop="static" keyboard={false} size="sm">
<Modal.Header closeButton>
<Modal.Title>Modal title</Modal.Title>
</Modal.Header>
<Modal.Body>
I will not close if you click outside me. Do not even try to press escape key.
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={handleClose}>
Close
</Button>
<Button variant="primary">Understood</Button>
</Modal.Footer>
</Modal>
</>
);
}

export default SmallModal;

Props

For more information or variant please visit to react-bootstrap