Modal
Modals focus the user’s attention exclusively on one task or piece of information via a window that sits on top of the page content.
The QtmModal is a main container with the following structure:
QtmModalHeaderwhich usually contains a titleQtmModalTitle, a subtitleQtmModalSubtitle, and the close icon.QtmModalBodywhich contains the information and/or controls needed to complete the modal’s task. It can include message text and components.QtmModalDividerwhich is divider between body and footer.QtmModalFooterwhich contains the main actions needed to complete or cancel the dialog task.
<QtmModal open>
<QtmModalHeader closeIcon>
<QtmModalTitle>
<QtmIcon
icon="warning"
classes="text-primary-500 dark:text-bluegrey-25"
></QtmIcon>
<div>
<QtmTypography>Dialog modal</QtmTypography>
<QtmModalSubtitle>Caption placeholder</QtmModalSubtitle>
</div>
</QtmModalTitle>
</QtmModalHeader>
<QtmModalBody>
<QtmTypography>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nulla, tempore
pariatur consectetur id autem ducimus odio harum, soluta quos illum
placeat adipisci sunt quaerat explicabo hic dolores quidem quam neque.
</QtmTypography>
<QtmTypography>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sequi, optio
quibusdam ipsam omnis, eum neque earum corporis mollitia reiciendis sint
molestiae excepturi illo laudantium architecto asperiores quae, culpa
tenetur. Modi?
</QtmTypography>
</QtmModalBody>
<QtmModalDivider></QtmModalDivider>
<QtmModalFooter classes="justify-between">
<QtmButton variant="ghost" color="primary">
Cancel
</QtmButton>
<QtmButton variant="filled" color="primary">
Confirm
</QtmButton>
</QtmModalFooter>
</QtmModal>
Size
There are three qtm-modal sizes: small, medium and large. You can use this property to control size of buttons and font size of icons and title in modal.
<QtmModal open size="small">
<QtmModalHeader closeIcon>
<QtmModalTitle>
<QtmIcon
icon="warning"
classes="text-primary-500 dark:text-bluegrey-25"
></QtmIcon>
<div>
<QtmTypography>Dialog modal</QtmTypography>
<QtmModalSubtitle>Caption placeholder</QtmModalSubtitle>
</div>
</QtmModalTitle>
</QtmModalHeader>
<QtmModalBody>...</QtmModalBody>
<QtmModalDivider></QtmModalDivider>
<QtmModalFooter classes="justify-between">
<QtmButton variant="ghost" color="primary">
Cancel
</QtmButton>
<QtmButton variant="filled" color="primary">
Confirm
</QtmButton>
</QtmModalFooter>
</QtmModal>
Custom action buttons
You can use utility classes to style footer layout.
<QtmModal open>
...
<QtmModalFooter classes="flex-col space-y-xs">
<QtmButton variant="ghost" color="primary" classes="w-full justify-center">
Cancel
</QtmButton>
<QtmButton variant="filled" color="primary" classes="w-full justify-center">
Confirm
</QtmButton>
</QtmModalFooter>
</QtmModal>
API
QtmModal
| Property | Type | Default | Description |
|---|---|---|---|
| classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing | |
| open | boolean | false | If true, the modal is displayed |
| overlay | boolean | true | If false, the overlay modal is transparent |
| overlayStyle | string | list of classes to override the styles applied to the modal overlay. ex: bg-primary-500 opacity-50 | |
| size | "large" | "medium" | "small" | 'medium' | Set size for title and all buttons in modal |
| Event | Type | Description |
|---|---|---|
| onCloseModal | CustomEvent<any> | Callback fired when the modal is closed |
QtmModalHeader
| Property | Type | Default | Description |
|---|---|---|---|
| classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing | |
| closeIcon | boolean | true | if true, a close button is displayed |
| size | "large" | "medium" | "small" | the size of the modal header |
| Event | Type | Description |
|---|---|---|
| onClosedButton | CustomEvent<any> | callback fired when the close button is clicked |
QtmModalTitle
| Property | Type | Default | Description |
|---|---|---|---|
| classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing |
QtmModalSubtitle
| Property | Type | Default | Description |
|---|---|---|---|
| classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing |
QtmModalBody
| Property | Type | Default | Description |
|---|---|---|---|
| classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing |
QtmModalDivider
| Property | Type | Default | Description |
|---|---|---|---|
| classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing |
QtmModalFooter
| Property | Type | Default | Description |
|---|---|---|---|
| classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing |
lightbulbSubmit an issue on GitLab