Skip to content

Accessibility: Partial

Translations: Not Needed

Modal

It just pops and shows you something.

Default

html
<template>
  <HLButton @click="showDefaultModal=!showDefaultModal" id="modal-btn-default">Default Modal</HLButton>
  <HLModal id="example-modal-default" type="default" v-model:show="showDefaultModal" :mask-closable="false">
    <template #header> Modal Header </template>
    {{modalText}}
  </HLModal>
</template>
<script setup lang="ts">
  import { HLModal, HLButton } from '@platform-ui/highrise'
  import { ref } from 'vue'
  const showDefaultModal = ref(false)
  const modalText = 'Tempore vivo desidero. Bene defungo perferendis calco avarus quas crepusculum accendo.'
</script>
html
<template>
  <HLButton @click="showInfoModal=!showInfoModal" id="modal-btn-info">Info Modal</HLButton>
  <HLModal id="example-modal-info" type="info" v-model:show="showInfoModal" :mask-closable="false">
    <template #header> Modal Header </template>
    {{modalText}}
  </HLModal>
</template>
<script setup lang="ts">
  import { HLModal, HLButton } from '@platform-ui/highrise'
  import { ref } from 'vue'
  const showInfoModal = ref(false)
  const modalText = 'Tempore vivo desidero. Bene defungo perferendis calco avarus quas crepusculum accendo.'
</script>
html
<template>
  <HLButton @click="showSuccessModal=!showSuccessModal" id="modal-btn-success">Success Modal</HLButton>
  <HLModal id="example-modal-success" type="success" v-model:show="showSuccessModal" :mask-closable="false">
    <template #header> Modal Header </template>
    {{modalText}}
  </HLModal>
</template>
<script setup lang="ts">
  import { HLModal, HLButton } from '@platform-ui/highrise'
  import { ref } from 'vue'
  const showSuccessModal = ref(false)
  const modalText = 'Tempore vivo desidero. Bene defungo perferendis calco avarus quas crepusculum accendo.'
</script>
html
<template>
  <HLButton @click="showWarningModal=!showWarningModal" id="modal-btn-warning">Warning Modal</HLButton>
  <HLModal id="example-modal-warning" type="warning" v-model:show="showWarningModal" :mask-closable="false">
    <template #header> Modal Header </template>
    {{modalText}}
  </HLModal>
</template>
<script setup lang="ts">
  import { HLModal, HLButton } from '@platform-ui/highrise'
  import { ref } from 'vue'
  const showWarningModal = ref(false)
  const modalText = 'Tempore vivo desidero. Bene defungo perferendis calco avarus quas crepusculum accendo.'
</script>
html
<template>
  <HLButton @click="showErrorModal=!showErrorModal" id="modal-btn-error">Error Modal</HLButton>
  <HLModal id="example-modal-error" type="error" v-model:show="showErrorModal" :mask-closable="false">
    <template #header> Modal Header </template>
    {{modalText}}
  </HLModal>
</template>
<script setup lang="ts">
  import { HLModal, HLButton } from '@platform-ui/highrise'
  import { ref } from 'vue'
  const showErrorModal = ref(false)
  const modalText = 'Tempore vivo desidero. Bene defungo perferendis calco avarus quas crepusculum accendo.'
</script>

With Custom Header

html
<HLButton @click="showCustomHeaderModal=!showCustomHeaderModal" id="modal-custom-header-btn-default">Open Modal</HLButton>
<HLModal id="example-custom-header-modal-default" type="default" v-model:show="showCustomHeaderModal">
  <template #header>
    <HLHeaderLite title="Modal Header" size="lg" subtitle="This is a sample subtitle" :closable="false">
      <template #header-icons>
        <HLIcon size="lg" color="black">
          <TrendUp01Icon />
        </HLIcon>
      </template>
    </HLHeaderLite>
  </template>
  {{modalText}}
</HLModal>

Show Back Button

html
<template>
  <HLButton @click="showBackModal=!showBackModal" id="modal-back-btn-default">Open Modal</HLButton>
  <HLModal
    id="example-back-modal-default"
    type="default"
    v-model:show="showBackModal"
    showBack
    @back="showBackModal=false"
    :mask-closable="false"
  >
    <template #header> Modal Header </template>
    {{modalText}}
  </HLModal>
</template>
<script setup lang="ts">
  import { HLModal, HLButton } from '@platform-ui/highrise'
  import { ref } from 'vue'
  const showBackModal = ref(false)
  const modalText = 'Tempore vivo desidero. Bene defungo perferendis calco avarus quas crepusculum accendo.'
</script>

Mask Closable

When the mask is closable, the modal will be closed when the mask is clicked.

html
<template>
  <HLButton @click="showMaskClosableModal=!showMaskClosableModal" id="modal-mask-closable-btn-default">Open Modal</HLButton>
  <HLModal id="example-mask-closable-modal-default" type="default" v-model:show="showMaskClosableModal" maskClosable>
    <template #header> Modal Header </template>
    {{modalText}}
  </HLModal>
</template>
<script setup lang="ts">
  import { HLModal, HLButton } from '@platform-ui/highrise'
  import { ref } from 'vue'
  const showMaskClosableModal = ref(false)
  const modalText = 'Tempore vivo desidero. Bene defungo perferendis calco avarus quas crepusculum accendo.'
</script>
html
<template>
  <HLButton @click="showModal=!showModal" id="modal-custom-header-footer-btn-default">Open Modal</HLButton>
  <HLModal id="example-custom-header-footer-modal-default" type="default" v-model:show="showModal">
    <template #header> Modal Header </template>
    {{modalText}}
    <template #footer>
      <div class="p-4">
        <HLSectionFooter id="footer" :top-padding="false" :bottom-padding="false" :horizontal-padding="false">
          <HLSectionFooterItem>
            <HLButton id="cancel">Discard</HLButton>
            <HLButton id="save" color="blue" variant="primary">Ok </HLButton>
          </HLSectionFooterItem>
        </HLSectionFooter>
      </div>
    </template>
  </HLModal>
</template>
<script setup lang="ts">
  import { HLModal, HLButton, HLSectionFooter, HLSectionFooterItem } from '@platform-ui/highrise'
  import { ref } from 'vue'
  const showModal = ref(false)
  const modalText = 'Tempore vivo desidero. Bene defungo perferendis calco avarus quas crepusculum accendo.'
</script>

Imports

ts
import { HLModal } from '@platform-ui/highrise'

Props

NameTypeDefaultDescription
id *string | undefinedundefinedThe unique identifier of the modal
autoFocusbooleanfalseAutomatically focus on the modal when opened
classNamestring | undefinedundefinedCustom class name for the modal
closeOnEscbooleantrueClose the modal when the Escape key is pressed
maskClosablebooleantrueClose the modal when clicking on the mask
showbooleanfalseControl the visibility of the modal
showBackbooleanfalseShow the back button in the modal
showClosebooleantrueShow the close button in the modal
showFooterbooleantrueShow the footer section in the modal
showHeaderbooleantrueShow the header section in the modal
showHeaderIconbooleantrueShow the icon in the header section
tostring | HTMLElement | undefinedundefinedSpecify the container to which the modal is appended
type'default' | 'info' | 'success' | 'warning' | 'error''default'Type of the modal indicating its purpose
widthnumber483Width of the modal in pixels
zIndexnumber | undefinedundefinedz-index of the modal

Emits

NameDefaultTrigger
@after-enter() => voidafter the modal has fully entered
@after-leave() => voidafter the modal has fully left
@back() => voidwhen the back button is clicked
@before-leave() => voidbefore the modal starts to leave
@close() => voidwhen the modal is closed
@esc() => voidwhen the Escape key is pressed
@left-click() => voidwhen the footer left button is clicked
@mask-click(payload: PointerEvent) => voidwhen the mask (overlay) is clicked
@right-primary-click() => voidwhen the footer right primary button is clicked
@right-secondary-click() => voidwhen the when the footer right secondary button is clicked
@update:show(payload: boolean) => voidwhen the visibility of the modal is updated (show/hide toggle)

Slots

NameParametersDescription
default()The default content slot
header()The header content slot
footer()The footer content slot