React Bootstrap Modal Component
Modal with Bootstrap Styling

Bootstrap 5 components designed for React.js
This component is part of the CoreUI for React.js UI components library, which offers all Bootstrap components designed to work seamlessly with React.js.
If you want to use Bootstrap 5 in a React.js environment while also needing advanced components that Bootstrap does not offer and dedicated developer support, then this library is the best solution for you.
Learn how to use the React Bootstrap Modal component from CoreUI to create accessible, responsive dialogs, confirmations, and popups using Bootstrap-styled modals.
How to use the React Bootstrap Modal component#
The React Bootstrap Modal component offers a lightweight, flexible popup for dialogs, alerts, and forms. It's fully customizable and accessible, with support for animations, scrollable content, multiple sizes, and more.
Static React Bootstrap Modal example#
This static modal example shows the structure of a modal with header, body, and footer content.
<CModal> <CModalHeader> <CModalTitle>React Modal title</CModalTitle> </CModalHeader> <CModalBody> <p>React Modal body text goes here.</p> </CModalBody> <CModalFooter> <CButton color="secondary">Close</CButton> <CButton color="primary">Save changes</CButton> </CModalFooter></CModal>
Live demo#
Static backdrop#
Scrolling long content#
Vertically centered modals#
Tooltips and popovers in modals#
Toggle between modals#
Change modal animation#
Use Sass variables like $modal-fade-transform
and $modal-show-transform
to customize animation. For example:
$modal-fade-transform: scale(0.8);
Remove modal animation#
Disable animation with:
<CModal transition={false}>...</CModal>
Accessibility tips#
Use aria-labelledby
and aria-describedby
on <CModal>
for improved screen reader support. CoreUI adds required roles and aria attributes automatically.
React Bootstrap Modal sizes#
Modals come in predefined sizes via the size
prop.
Size | Prop | Max width |
---|---|---|
Small | 'sm' | 300px |
Default | — | 500px |
Large | 'lg' | 800px |
Extra large | 'xl' | 1140px |
Fullscreen React Bootstrap Modals#
Use the fullscreen
prop to make modals expand to full viewport width/height. You can apply it conditionally based on breakpoints.
Fullscreen prop | Breakpoint |
---|---|
true | Always |
'sm' | Below 576px |
'md' | Below 768px |
'lg' | Below 992px |
'xl' | Below 1200px |
'xxl' | Below 1400px |
API reference#
Explore the API for the React Bootstrap Modal component and its related parts: