- Example
- Prop Table
import { Modal } from '@duik/it'
import Modal from '@duik/modal'
Dashboard UI Kit gives you several components to effectively build nice and clean modals. Modals can be used anywhere in the code structure, the actuall DOM will be rendered in the body
with help of react portal.
<Modal isOpen={modalOpenState.isOpen} handleClose={modalOpenState.handleClose} closeOnOuterClick sm > <Modal.Header> <Modal.Title>Can you guess the place?</Modal.Title> </Modal.Header> <img src="https://images.unsplash.com/photo-1587732608058-5ccfedd3ea63?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80" style={{ width: '100%', }} /> <Modal.Body> <FormGroupContainer> <Radio name="question_1" label="Wyoming, US" /> <Radio name="question_1" label="Dolomiti, Italy" /> <Radio name="question_1" label="Pamir, Tajikistan" /> </FormGroupContainer> </Modal.Body> <Modal.Footer> <Button primary>Submit Answer</Button> </Modal.Footer> </Modal>
<div class="outer-events-handler modal sm"> <button class="btn btn-clear btn-square modal-btn-close" aria-label="Close" type="button" role="button"> <span class="modal-close-icon"></span> </button> <div class="modal-header"> <h2 class="">Can you guess the place?</h2> </div> <img src="https://images.unsplash.com/photo-1587732608058-5ccfedd3ea63?ixlib=rb-1.2.1&amp;auto=format&amp;fit=crop&amp;w=1950&amp;q=80" alt="mountains" style="width:100%" /> <div class="modal-body"> <div class="form-group-container"> <label class="form-check form-group radio"> <input type="radio" class="form-check-input" name="question_1" /> <span class="form-check-label">Wyoming, US</span> </label> <label class="form-check form-group radio"> <input type="radio" class="form-check-input" name="question_1" /> <span class="form-check-label">Dolomiti, Italy</span> </label> <label class="form-check form-group radio"> <input type="radio" class="form-check-input" name="question_1" /> <span class="form-check-label">Pamir, Tajikistan</span> </label> </div> </div> <div class="modal-footer"> <button class="btn btn-primary" type="button" role="button">Submit Answer</button> </div> </div>
className | Required: false |
type: string | |
className, e.g. "my-custom-styling" |
sm | Required: false |
type: boolean | |
Renders smaller modal of width up to 560px (default 760px) |
lg | Required: false |
type: boolean | |
Renders larger modal of width up to 1200px (default 760px) |
full | Required: false |
type: boolean | |
Renders modal that will fill the width of the screen (default 760px) |
isOpen | Required: false |
type: boolean | |
Boolean property whether is the modal opened or not |
jumbo | Required: false |
type: boolean | |
Renders larger avatar with height 120px |
handleClose | Required: false |
type: () => void | default value: undefined |
Provide a handler when it is required to close the window, e.g. on close button. |
hideCloseButton | Required: false |
type: boolean | |
Hides the close button |
closeOnOuterClick | Required: false |
type: boolean | |
handleClose will be triggered when user clicks outside the modal |
portalEl | Required: false |
type: HTMLElement | default value: document.body |
By default modal will be rendered in <body>, you can provide a different dom element to be rendered in. |
...rest | Required: false |
type: any | |
Other properties are passed down to the wrapping element |