Modal
See React Bootstrap/Modals for full documentation and props.
The Modal component can have many possible variations. The most basic usage is to render a Modal with all content in the body and an optional Modal.Icon.
The Modal.Icon component can by styled by providing a variant prop. The default variant is 'info'.
Modal with header
When using the Modal.Header component the Modal.Icon should be placed within the header to the left of the Modal.Title.
Centered and stacked
This variation of the Modal moves the content of the footer into the body and centers all content vertically. Using the d-grid
utility class around Buttons will force them to take the full width of their container.
Other footer configurations
Interactive footer content (checkboxes or links) should be positioned to the start of the footer. The buttons should be remain positioned to the end of the footer.
Modal with a form
Using a form ref in Modal.Footer
To make sure there are not duplicate footers when using a Form inside a Modal, pass a function that returns null into the Form's footerRenderer
prop. A ref to the Form can be used to call submit when one of the buttons in the Modal's footer is pressed.
Using a custom footer renderer
It's also possible to wrap the contents of the modal in a Form and use the footerRenderer
prop to render the buttons in the footer. This way, the form can be submitted by calling the onSubmit
function passed to the footerRenderer
prop.
Analytics
The Modal component is trackable through Kyber Analytics. This is the default analytics config.
export default {
value: 'Modal',
actions: {
onHide: { type: 'MODAL_ON_HIDE', payload: 'Hide' },
},
};