Modal Development
certara-modal
Component for modal and dialog content
Properties
centered
Attribute | centered |
Type | boolean |
Default | false |
Required | false |
Description | Boolean value to center the modal vertically in the view port. If false, the modal will appear at the top of the screen. |
heading
Attribute | heading |
Type | string |
Default | undefined |
Required | false |
Description | The text to display in the heading of the modal |
modeless
Attribute | modeless |
Type | boolean |
Default | false |
Required | false |
Description | Will set modal to modeless, allowing interaction with the rest of the page and remvoing the backdrop. |
open
Attribute | open |
Type | boolean |
Default | false |
Required | false |
Description | Boolean value to open and close the modal. If true, the modal will appear, if false, the modal will hide. |
position
Attribute | position |
Type | "left" | "right" |
Default | 'left' |
Required | false |
Description | Anchor position of modal only when sidebar=‘true’. Valid values are ‘left’ and ‘right’ (default is ‘left’). |
scrollable
Attribute | scrollable |
Type | boolean |
Default | false |
Required | false |
Description | If true, the body of the modal will be scrollable if the contents reach overflow. If false, the entire modal, including header and footer will be scrollable if the content reaches overflow. |
sidebar
Attribute | sidebar |
Type | boolean |
Default | false |
Required | false |
Description | If true, this will render the modal appearing as an anchored sidebar (default anchor position is left of viewport) |
size
Attribute | size |
Type | "fullscreen" | "lg" | "md" | "sm" | "xl" |
Default | 'md' |
Required | false |
Description | The size of the modal |
Events
Name | Description | Bubbles |
---|---|---|
certaraClose | Fired when the modal is closed via the close button, or the escape key. | true |
Methods
There are no public methods available for this component
Slots
Name | Description |
---|---|
body | Slot for the modal body content |
footer | Slot for the footer content, typically action buttons |
header | Slot for the modal header content. Use this if you need more custom content in the heading. If you just need a title, use the heading attribute. |
Legacy
Relies on the third-party libraryBootstrap 4.6for its features and functionality.View Bootstrap’s modal doc
<!-- this sets a black overlay over the entire viewport with opacity--><div class="modal-backdrop show"></div><!-- modal container --><div class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" data-keyboard="true" data-backdrop="static" style="display:block"> <!-- actual modal width --> <div class="modal-dialog modal-md" role="document"> <div class="modal-content"> <div class="modal-header"> <h3 class="modal-title">…</h3> <button type="button" class="btn--close" data-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body">…</div> <div class="modal-footer">…</div> </div> </div></div>
NameDescriptionClassCopy
- headerHeading content. Contains the title and the close icon.
.modal__header
- titleThe semantic title of the modal
.modal__title
- dismissCloses the modal
.btn-close
- descriptionDescription content
.modal__body
- footerClassesfooter content
.modal__footer
- brand buttonPrimary CTA
.btn—brand
- light buttonSecondary CTA
.btn—secondary
- link buttonHeading content
.btn-link
NameSizeClassCopy
- Small350px
.modal—sm
- Large800px
.modal—lg
- X-large1200px
.modal—xl
- FullscreenWidth of viewport
.modal—fullscreen
@modal(title = "", id = "", isDismissable = true, isFullScreen = false) { (…body)} { (…buttons)}
PropTypeDefaultDescription
- isDismissablebooleantrue
appends close button to
modal-header
- isFullScreenbooleanfalsemakes the modal expand the full width of the viewport
- widthstring
md | sm | lg | xl
modal size - idstringnoneadd id to modal
SlotType
- {body}html
- {buttons}
html (outputs call-to-actions in
modal-footer
)
import Modal from 'react-bootstrap/Modal';
const Example = () => ( <Modal id="" show={props.show} onHide={props.onHide} role="dialog" dialogClassName=""> <Modal.Header closeButton> <Modal.Title>…</Modal.Title> </Modal.Header> <Modal.Body>…</Modal.Body> <Modal.Footer>…</Modal.Footer> </Modal>);
render(<Example />);
PropTypeDefaultDescription
- idstringnoneadd id to modal
- shownonefunction for when modal is invoked
- onHidenonefunction for when modal is hidden
- dialogClassNamestringnoneappended to
.modal-dialog
, i.e.modal-dialog-lg